Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Codea Competition (Need input on v2)

edited January 2012 in General Posts: 2,820

Hello amazing programers,
We are all anxious for the Codea competition. In the mean time while TLL sets that up, I have my own little competition on my new website. Of coarse, it is a little junky, but it will do for now. You will find it here. Hurry up!

They all were amazing, but I really liked @Mark's...

Tagged:
«1

Comments

  • edited January 2012 Posts: 622

    You may want to make honorary awards for existing apps. There are many existing utilities and games

  • Posts: 2,820

    Like...
    Did you read the entire thing?
    You could get an app under $5 for free. I will hand out certificates. You should sign up. You are an amazing coder in my opinion.

  • Posts: 622

    Thx, I just mean you may want to honorary award existing things so that people only submit new.

  • Posts: 2,820

    Alright. Thanks. I will. That's a good point. You should upload something... Even if it's already been coded.

  • Posts: 1,255

    You might want to consider giving a "theme" to your competition. For example, the recent Ludum Dare 22 was "Alone." Another competition in Australia pulled three words out of a hat to come up with "Key," "Badger," and "Suit" -- all of which had to feature in submitted games.

    Using a theme helps ensure you're getting something original, and it's interesting to see how people but a differnt spin on the words. For example, in the AU competition, some people used suit as in "suit of clothes" while others used it as in "suit of cards." One team even choose to interpret key as islands, like in "Florida Keys."

  • Posts: 447

    Mark, that article about the badger game competition was pretty interesting. Thanks for posting.

  • Posts: 2,820

    Alright. Thanks to you guys for the suggestions. I have updated and changed a few things. Please, please submit your apps. I think this could be really cool if a lot of people posted their code.
    Thanks!

  • Posts: 78

    I've been thinking of something to try and code for a while and am not sure what to do...(please don't say be creative, my parents say that too much)

  • Posts: 622

    Jan 12 which time zone :)

  • Posts: 622

    It can only use the space sprite pack .... is Spritely allowed if it is pasted in as code? ... Is use of drawing only (line, ellispe, rect like my bee)

  • Posts: 447

    Ldsguy1, one idea (a bit stolen from the article Matt posted in another thread) is to have your avatar floating around with a protective shield that only covers one side, and the player has to direct the shield to the left, right, up, down so that when the avatar bounces on the walls, it doesn't die because the walls are made of a deadly laser or something.

    Something like that, I haven't thought much about it. Feel free to take and run with it. Gravity, moving the shield through the orientation of the ipad, enemies, could all work.

  • Posts: 2,820

    Sorry about that everyone. Yes, you may use the wonderful tool Spritely. The graphics must still be space related. I'll change it.

  • Posts: 2,820

    And sorry about the messy comment leaver. I'll see if I can fix that.

  • edited January 2012 Posts: 622
  • Posts: 2,820

    Alright...

  • Posts: 1,255

    For those who can still import projects, here's my submission as a Codea file.

    http://devilstower.posterous.com/orb-bits

    I decided to go very simple -- touch anywhere on the screen to thrust and... That's it. Land on all the planets without falling into the sun or colliding with an asteroid. See how many systems you can explore.

  • Posts: 1,255

    Here's the copy/paste version. Only three files, less than 400 lines. So it's not so bad to load this way. No sprites at all, not even from Spritely.

    https://gist.github.com/1579471

  • Posts: 622

    @Mark, like a real arcade game, very nice

  • Very cool :) i Love the Mega gravity if you come to close to the sun :)

  • Posts: 2,820

    Cool. Like it. 2 competitors in the game section.

  • Posts: 40

    Uh @Zoyt is it ok to post my game code here

  • edited January 2012 Posts: 40
    ENEMY_SPAWN_EASY = 0
    ENEMY_SPAWN_HARD = 1
    
    EnemyHorde = class()
    
    function EnemyHorde:init()
        -- you can accept and set parameters here
        self.frame = 0
        self.units = {} -- enemy units
        self.heroBullets = {} -- hero's bullets
        self.explosions = {}
        self.enemySize = 50
        self.killCount = 0
        self.spawnPattern = ENEMY_SPAWN_EASY 
    end
    
    function EnemyHorde:draw()
        self.frame = (self.frame+1)%128
    
        pushStyle()
    
        if self.spawnPattern == ENEMY_SPAWN_EASY then
            fill(123, 25, 100, 255)
        else
            fill(16, 221, 4, 255)
        end
    
        stroke(62, 33, 37, 255)
        strokeWidth(4)
    
        -- Spawn random enemy every 100 frames
        if self.frame%50 == 0 then
            spawn = vec2( math.random(WIDTH), HEIGHT + self.enemySize )
            table.insert( self.units, spawn )
        end
    
        for i,v in ipairs(self.units) do
            -- Move unit down
            v.y = v.y - 5    
    
            -- If hard, move in sine wave
            if self.spawnPattern == ENEMY_SPAWN_HARD then
                -- Compute movement vector
                sideMove = vec2( math.sin(v.y * 0.02) * 60, 0 )
                v = v + sideMove
            end
    
            -- Cull unit
            culled = false
            if (v.y + self.enemySize) < 0 then
                table.remove(self.units, i)
                culled = true -- no continue statement
            end 
    
            -- Check if hit by a bullet
            if culled == false then
                for j,b in ipairs(self.heroBullets) do
                    if v:dist(b) < self.enemySize/2 then
                        table.remove(self.units, i)
                        table.remove(self.heroBullets, j)
                        
                        -- Explode!
                        table.insert(self.explosions, Explosion(v))
    
                        -- Update killCount
                        self.killCount = self.killCount + 1
                    end
                end
            end
    
            -- Draw unit
            sprite("Tyrian Remastered:Blimp Boss", v.x, v.y, self.enemySize, self.enemySize)
            
        end
    
        -- Draw explosions
        for i,e in ipairs(self.explosions) do
            e:draw()
    
            if e:isDone() then
                table.remove(self.explosions,i)
            end
        end
    
        popStyle()
    end
    
  • edited January 2012 Posts: 40
    Explosion = class()
    
    function Explosion:init(pos)
        self.position = pos
        self.opacity = 255
        self.time = 0
        self.lines = {}
    
        sound("explode",1285)
    
        for i = 1,10 do
            dir = vec2(0,1)
            dir = dir:rotate( math.rad(math.random(360)) )
            table.insert( self.lines, dir*math.random(2,7) )
        end
    end
    
    function Explosion:isDone()
        return self.opacity <= 0
    end
    
    function Explosion:draw()
        self.time = self.time + 1.939
        
        pushStyle()
        lineCapMode(ROUND)
        strokeWidth(6)
        smooth()
        stroke(255, 146, 0, 255)
    
        p = self.position
        for i,v in ipairs(self.lines) do
            vt = p + v * self.time
            line(p.x, p.y, vt.x, vt.y) 
        end
    
        self.opacity = 255 * (1 - (self.time/30));
    
        popStyle()
    end
    
  • edited January 2012 Posts: 40
    Invader = class()
    
    function Invader:init()
        self.position = vec2(0,0)
        self.bullets = {}
        self.frame = 0
    end
    
    function Invader:spawnBullet()
        sound("shoot",77)
        table.insert( self.bullets, vec2( self.position.x, self.position.y + 30 ) )
    end
    
    function Invader:drawBullets()
        -- Spawn bullets
        if self.frame%30 == 0 then
            self:spawnBullet()
        end
    
        -- Move, draw, cull bullets
        for i,v in ipairs(self.bullets) do
            v.y = v.y + 3
    
            rect(v.x, v.y, 2.5, 45)
    
            if v.y > (HEIGHT + 10) then
                table.remove(self.bullets,i)
            end 
        end
    end
    
    function Invader:draw()
        self.frame = (self.frame + 1)%128
    
        pushMatrix()
        pushStyle()
        
        -- Set up basic graphical style
        lineCapMode(ROUND)
        strokeWidth(8)
        stroke(222, 12, 12, 255)
        smooth()
        noFill()
    
        -- Transform to pos
        translate(self.position.x, self.position.y)
    
        -- Draw our triangle invader
        -- 60 pixels high, 40 pixels wide
       fill(47, 34, 34, 255)
         line( 0, 30, 20, -30 )
        line( 0, 30,-20, -30 )
        line( -20, -30, 20, -30 )
        sprite("Tyrian Remastered:Boss D")
    
        popMatrix()
    
        self:drawBullets()
    
        popStyle()
    end
    
    function Invader:touched(touch)
        -- Codea currently does not automatically call this method
    end
    
  • edited January 2012 Posts: 40
    hero = nil
    enemies = nil
    bgLines = nil
    explosion = nil
    
    GAME_PLAYING = 0
    GAME_DEAD = 1
    state = GAME_PLAYING
    
    -- Use this function to perform your initial setup
    function setup()
        state = GAME_PLAYING
    
        iparameter("BackgroundSpawnRate",0,3,2)
    
        hero = Invader()
        hero.position = vec2(WIDTH/2, 150)
    
        enemies = EnemyHorde()
        enemies.heroBullets = hero.bullets
    
        bgLines = StreamingLines()
    end
    
    function touchingAtPos()
        if CurrentTouch.state == BEGAN or 
           CurrentTouch.state == MOVING then
            return vec2( CurrentTouch.x, CurrentTouch.y )
        end 
    
        return nil
    end
    
    -- This function gets called once every frame
    function draw()
        background(12, 0, 255, 255)
    
        bgLines.spawnRate = BackgroundSpawnRate
    
        bgLines:update()
        bgLines:draw()
    
        if state == GAME_PLAYING then 
            -- Process touch
            touch = touchingAtPos()
            if touch then
                if touch.x < (hero.position.x - 10) then
                    hero.position.x = hero.position.x - 3
                elseif touch.x > (hero.position.x + 10) then
                    hero.position.x = hero.position.x + 3
                end
            end
    
            if enemies.killCount == 5 then
                enemies.spawnPattern = ENEMY_SPAWN_HARD
            end
    
            enemies:draw()
    
            hero:draw()
    
            -- Check if hero is hit
            for i,v in ipairs(enemies.units) do
                if v:dist(hero.position) < 60 then
                    state = GAME_DEAD
                    explosion = Explosion(hero.position)
                end
            end
        elseif state == GAME_DEAD then
            if explosion then
                explosion:draw()
                if explosion:isDone() then
                    explosion = nil
                end
            end
        end
    end
    
  • edited January 2012 Posts: 40
    -- This class draws the lines streaming past in the background
    -- of the game. We spawn and delete them in the self.lines table
    
    ----------------------------------------------
    -- Single line
    ----------------------------------------------
    StreamLine = class()
    function StreamLine:init(pos, vel)
        self.position = pos
        self.velocity = vel
    end
    
    function StreamLine:update()
        self.position.y = self.position.y - self.velocity
    end
    
    function StreamLine:draw()
        p = self.position
        line(p.x,p.y,p.x,p.y + self.velocity)
    end
    
    function StreamLine:shouldCull()
        -- Check if off the bottom of the screen
        if (self.position.y + self.velocity) < 0 then
            return true
        end 
    
        return false
    end
    
    ----------------------------------------------
    -- All lines
    ----------------------------------------------
    StreamingLines = class()
    
    function StreamingLines:init()
        self.minSpeed = 5
        self.speed = 30
        self.spawnRate = 2
        self.lines = {}
    end
    
    function StreamingLines:updateAndCull()
        toCull = {}
        for i,v in ipairs(self.lines) do
            if v:shouldCull() then
                -- table.insert( toCull, i )
                table.remove( self.lines, i )
            else
                v:update()
            end
        end
    
        -- print("Removing ", #toCull)
        --for i = #toCull,1,-1 do
        --    table.remove( self.lines, i )
        --end
    end
    
    function StreamingLines:update()
        -- Create spawnRate lines per update
        for i = 1,self.spawnRate do
            -- Generate random spawn location
            vel = math.random(self.minSpeed, self.speed)
            spawn = vec2( math.random(WIDTH), HEIGHT + vel )
    
            table.insert(self.lines, StreamLine(spawn, vel))
        end
    
        -- Update and cull offscreen lines
        self:updateAndCull()
    end
    
    function StreamingLines:draw()
        --print("Num lines = ", #self.lines)
    
        pushStyle()
    
        noSmooth()
        stroke(252, 205, 6, 173)
        strokeWidth(2)
        lineCapMode(SQUARE)
     
        for i,v in ipairs(self.lines) do
            v:draw()
        end
    
        popStyle()
    end
    
  • JohnJohn Admin Mod
    Posts: 629

    @MICHAEL please remember to put three ~ characters on the lines above and below your code blocks. Otherwise the code will be unreadable and messy in your posts. I've fixed it for you this time.

    Also, I wouldn't recommend sharing your code directly in a competition thread when you have multiple tabs, as it makes it difficult to follow the content of the thread.

  • Posts: 40

    Thank you @John sorry for forgetting about the ~~~ do you have any recommendations as to how I should go about posting my code for this competition I was unsure of the best way

  • JohnJohn Admin Mod
    Posts: 629

    A lot of people use posterous.com which lets you post stuff via email, by setting up an account and emailing to send@posterous.com (i think). You can then provide the links on the forum.

  • BortelsBortels Mod
    Posts: 1,557

    post@posterous.com.

    I strongly recommend gist.github.com. Has versioning, easy copy and paste. Posterous worked better for binary files like .codea and screenshots.

  • Posts: 2,820

    Next time I do this, I'll try to do a better way on my website. Thanks for the participation!

  • SimeonSimeon Admin Mod
    Posts: 5,411

    Just tried your game, @Mark. Really fun. Couldn't get past the second level though :)

  • Posts: 1,255

    Thanks. If it's any consolation, I still die on that stage about 1/2 the time, and it probably took me me a dozen tries to get past the third screen. I only bothered to actually put in four "hand crafted" puzzles, after which the levels are generated randomly, and usually end up being easier than the first four.

  • SimeonSimeon Admin Mod
    Posts: 5,411

    The level transition sequence is pretty fantastic. I really like the way everything blasts out and the new level comes in.

  • Posts: 40

    @mark I am sitting in class and just tried your game it is awesome I was having trouble with stage 2 so I gave myself a little fuel boost :-D

  • Posts: 40

    @Bortels and @John thank you I will post code there and just put a link to it from a comment

  • Posts: 1,255

    @Simeon, you can think of this whole game as my leaning the joys of translate() and playing with scale. I tried actively varying the scale so that the ship is actually always the same physical distance from the "sun," but I found it kind of disorientating.

    Oh, and I cheated by using a global variable for scale, but then these classes are't exactly the kind of thing you'd extract for another program in any case.

  • Posts: 2,161

    It's stretching the term "space" to its limits, but I'd like to submit my program for exploring "Complex Euclidean Space": http://www.math.ntnu.no/~stacey/HowDidIDoThat/iPad/Codea.html (scroll down to the projects, the one named "Complex Plane").

  • Posts: 2,820

    @MICHAEL - If you could give a link to the code, that would be great. (Mabey put it on a hidden page on WordPress) Thanks!

  • edited January 2012 Posts: 2,820

    And just to let you know, a whole new website coming soon. Better comments and possible an uploadedibg service for your code.

  • Posts: 78

    Here is my submission. It is a space themed checkers. It is missing a few things and if you drag one checker over another they stick, but enjoy!

    https://gist.github.com/2fa8a8533bdf79b44166

  • edited January 2012 Posts: 2,820

    Cool! Can't wait to try it!

  • Posts: 2,820

    I have no utilities! I really would like some! It's not that hard, is it? Spritely could easily be entered. Come on! You may enter one into games and one into utilities. @Andrew_Stacey - Possibly your 3D cube with a customizable amount of vertices? I'd allow it.

  • Posts: 2,161

    Could you clarify what you mean by "utility"? Spritely is definitely a utility in that it helps with writing other projects. Much of my code is designed to be reused, but the code itself is not what I would call a utility.

    Did my complex space explorer, lonked above, qualify? Is that a "utility"?

  • Posts: 2,820

    That is a good point. Thank you. I'll change it to "Other".

  • edited January 2012 Posts: 5

    My contribution to the competition:
    http://twolivesleft.com/Codea/Talk/discussion/480/swoosh-a-simple-asteroid-dodging-game

    Still a lot of things I would like to fix(like gems spawning inside rocks), but I can always update the pastebin I guess. :P

    Edit: I'm suddenly realizing you might have meant the SpaceCute sprite pack, and not the Tyrian one. Does it matter?

  • Posts: 2,820

    @Drablos - Sorry. Yes, you may use any sprites as long as it has to do with space. Sorry for the mis communication.

  • edited January 2012 Posts: 2,820

  • Posts: 2,820

    I am just confirming that these are the correct pieces of code and the right people. Please respond.

    @Ipda41001 - http://twolivesleft.com/Codea/Talk/discussion/466/loic-low-orbit-ion-cannon-game
    @Mark - http://devilstower.posterous.com/orb-bits
    @Andrew_Sacey - http://www.math.ntnu.no/~stacey/HowDidIDoThat/iPad/Codea.html (scroll to "Complex Plane")
    @Ldsguy1 - https://gist.github.com/2fa8a8533bdf79b44166
    @Drablos - http://twolivesleft.com/Codea/Talk/discussion/480/swoosh-a-simple-asteroid-dodging-game
    @MICHAEL - See code above

    I need more than zero people in the drawing section. PLEASE LET OTHERS KNOW AND FEEL FREE TO SUBMIT ANOTHER PEICE OF CODE TO THAT SECTION!

  • Posts: 622

    Yes, that's the one

Sign In or Register to comment.