The Codea Holiday Cook Off

So, when is the limit for Europe/Spain hour?, i didnt understand that

This is a double post. The exact same post in is my update post in the competition thread. Wasn’t sure if we needed to post the final product ‘here’ or ‘there’, so it’s now ‘there’ and ‘here’ (Nice pun eh?)

Alright! It’s done. Was going to add some sound, but sometimes silence is best. I am sick (literally, I have some sort of weird form of viral walking pneumonia) and can tell I will be out for a few days.

The easiest way to play is to start up Aircode in Codea and copy and paste the ‘all code in one file’ following into Main:

https://github.com/MrScience101/bit-all-in-one/blob/master/Main

If you want to see how pretty the code looks in separate files you can see how I separated them here:

https://github.com/MrScience101/Bit-not-the-Byte

I have a codea community account and will be trying to get it into there. I’ll post again when it is available in the codea community.

Update: Bit not the Byte is now available on Codea Community

So fire up aircode and go save Bit not the Byte from the FALL of his life! Good luck!

A video of the current progress

http://www.youtube.com/watch?v=v8WbOvIgwG4

And some code, just the game and player class, keep it simple

Player = class()
PLAYER = 1
function Player:init()
    self.ball = physics.body(CIRCLE, 25*w)
    self.imgs = {
        readImage("castleFall:p1_front"),
        readImage("castleFall:p1_stand"),
        readImage("castleFall:p1_jump"),
        readImage("castleFall:p1_duck"),
        readImage("castleFall:p1_hurt")
    }
    -- add walk images 
    for i=1,9 do
        table.insert(self.imgs, 
            readImage("castleFall:p1_walk0"..i)
        )
    end
    
    -- initializate player data structures
    self:initPlayer()
end

function Player:initPlayer()
    self.nState = 1
    self.direction = 0
    self.ball.linearDamping = 0
    self.ball.sleepingAllowed = false
    self.ball.interpolate= true
    self.ball.x = WIDTH/2
    self.ball.y = HEIGHT/2+100
    self.ball.restitution = 0
    self.ball.mask = {WALL}
    self.ball.categories = {PLAYER}
    self.ball.friction = 0
    self.ball.info = {
     t = PLAYER
    }
    self.nRedGems   = 0
    self.nBlueGems  = 0
    self.nGreenGems = 0
    self.walkAnim   = nil
    self.walkID     = nil
    self.jumping    = false
    
    self.playerLastPos = {}
end

function Player:update()
    --[[
    local walls = game.levels.walls
    for j,wall in ipairs(walls) do
        if self.ball:testOverlap(wall.body) then
            
            break
        end
    end
    ]]--
    if self.walkID~=nil then
        self.nState = math.floor(self.walkAnim.nstate)
    end
end

function Player:drawTrail()
    local ball = self.ball
    noTint()
    
    if ball.linearVelocity:len()<4 then return end
    
    if #self.playerLastPos<2 or
        self.playerLastPos[#self.playerLastPos]:dist(ball.position)>6
    then
        table.insert(self.playerLastPos, ball.position)
        if #self.playerLastPos>11 then 
            table.remove(self.playerLastPos, 1)
        end
    end
    blendMode(ADDITIVE)
    local l = nil
    for k,p in ipairs(self.playerLastPos) do
        if l then
            local a = math.fmod(k,11)
            strokeWidth(a)
            stroke(233-(a*11), 166-k-2)
            line(p.x,p.y, l.x, l.y)
        end
        l = p
    end
    blendMode(NORMAL)
end

function Player:draw()
    self:update()
    self:drawTrail()
    local d = self.direction
    if d == 0 then d = 1 end
    sprite(
        self.imgs[self.nState], 
        self.ball.x, 
        self.ball.y+((self.imgs[self.nState].height)/2)-self.ball.radius,
        self.imgs[self.nState].width*d,
        self.imgs[self.nState].height
    )
end

function Player:jump(axis)
    if self.jumping then return end
    local d = self.direction
    -- wait for the char to hit the ground
    self:stop(self.ball.linearVelocity)
    self.direction = d
    self.jumping = true
    self.nState  = 3
    if useSound then
        sound("A Hero's Quest:Swing 3")
    end
    
    self.ball:applyForce(
        vec2(
         1000*self.direction*axis.x*DeltaTime,
         40000*axis.y*DeltaTime
        ), 
        self.ball.worldCenter
    )
   
   
 
end

function Player:walk(axis)
    if self.jumping then return end
    local x = self.direction
    if axis.x > 0 then
        self.direction = 1
    else
        self.direction = -1
    end
    if self.direction ~= x then
        x = self.direction
        self:stop(vec2(0,0))
        self.direction = x
    end
    -- move player with a force:
    self.ball:applyForce(
        vec2(2000*axis.x*DeltaTime,0), 
        self.ball.worldCenter
    )
    
    if self.walkID == nil then
        self.nState   = 6
        self.walkAnim = {nstate = 6}
        self.walkID = tween(
         1/2, self.walkAnim, {nstate=12}, 
         {easing=tween.easing.linear,
          loop =tween.loop.pingpong}
        )
    end
end 

function Player:stop(axis)
    if self.walkID ~= nil then
        tween.stop(self.walkID)
        self.walkID = nil
    end
    self.ball.linearVelocity = axis
    self.ball.angularVelocity= 0
    self.ball.linearDamping  = 0
    self.direction = 0
    self.nState = 1
end

function Player:touched(touch)
    if touch.state == BEGAN then 
        
    end
end


function Player:collide(contact)
    
    if contact.bodyA and contact.bodyB and 
       contact.bodyA.info and contact.bodyB.info and
       contact.bodyA.info.t == WALL and 
       contact.bodyB.info.t == PLAYER 
    then
        if contact.state == BEGAN then
            if self.direction ~= 0 then
                self:walk(vec2(self.direction,0))
            else
                self:stop(vec2(0,0))
            end
            if useSound then
                sound("A Hero's Quest:Drop")
            end
            self.jumping = false
        elseif contact.state == ENDED and math.abs(self.ball.linearVelocity.y) > 0 then
            self.jumping = true
        end
    end
end

Game class :

Game = class()

function Game:init()
    self.nLevel= 1
    self.sky   = Sky   (self.nLevel)
    self.levels= Levels(self.nLevel)
    self.player= Player()
    self.hud   = HUD   (self.player)
end

function Game:draw()
    pushMatrix()
        translate(WIDTH/2-self.player.ball.x,HEIGHT/2-self.player.ball.y)
        self.sky:draw()
        self.levels:draw()
        self.player:draw()
    popMatrix()
    self.hud:draw()
end

function Game:touched(touch)
    self.hud :touched(touch)
end

function Game:collide(contact)
    self.player:collide(contact)
end

I ll post more soon, gtg , i am busy now :smiley:

I’ll work through the times and post more tomorrow. About 36 hours to go.

An entry update.
Video:

http://youtu.be/JDGMAx0fc34

Sprite pack:
http://www.kenney.nl/post/platformer-art-assets-deluxe
Put all those sprites Inside castleFall.assetPack and you Will be succeed :wink:
Download Spritepack

Source code:
https://gist.github.com/juaxix/8178134

It is ready for iPhone and iPad

A little comment about the game:
This game is a metaphor of a mental inquiry process.
We are falling through the mind of Hombert, who is this guy?
Hombert is like any other man, but with a mental disorder.

We , as players/users ,are falling all the way acting as his psychiatrists, and our mission is to help Hombert bring back good memories in the shape of beautiful gems of our inside.
In our minds there is always a common danger, take a fake way can result in death, as we fall through the heights of insane madness.

Convoluted labyrinths represent the intrincate waves of thoughts, where we need to set checkpoints like memory tokens to be able to go back once we are in the darkness/death.

You have to avoid the fires, the potential fake doors in our minds that makes Hombert to suffer.

Control Hombert with the virtual gamepad and jump button.
Touch enemies to transmute them into gems, flies are memory garbage.

Enjoy, have fun and luck!

24 hours to go (ok, 23 because I forgot to post this). As indicated, the contest ends at the stroke of midnight in Adelaide.

For folks in London, that will be 1:30 in the afternoon.

For New York, 8:30 in the morning. And yes, for the west coasters in the US that does mean the clock runs down at 5:30 in the $@!&# AM. For those in Hawaii… seriously, you’re in Hawaii. Go surf or something.

Here is a timer. Click on the link and it will tell you how much time is left in the contest, regardless of where you are:

http://www.timeanddate.com/counters/newyear.html?p0=5

@Mark thank you for putting this contest on and for all the hard work you have put into it.

@skullagepk

A. The only fall part I’ve seen in there is the gems falling in the background, not really anything to do with gameplay.

B. Clone of Cookie Clicker.

C. You’ve been working on that since WAY before the contest, this contest is for new code only, not working on past projects, and new ideas.

Crud. I thought I had one day left. Why couldn’t you have had the time at GMT, rather than GMT + 10:30…?

I have to add so much more stuff and I thought I was gonna power through it tomorrow :-S

My development thread is here http://www.twolivesleft.com/Codea/Talk/discussion/4341/cook-off-going-south-migrating-birds-update%3A-added-gist-installer#Item_25 for the cook off.

It was fun and really nice to see your creations!

Got my project on CC, FallDodge.

It’s almost done… I need to add in 2 more quick things, a highscores screen (with @Briarfox’s score tracker) and a lose screen for the lava at the bottom.

A few bugs will be fixed tomorrow, and graphical fixes for the intro.

The Ludum Dare competition allows revisions for game breaking bugs… I hope I can at least quickly tomorrow add some tiny and required game mechanics (losing).

I would work more if I could, but my parents say I can’t pull an all-nighter and my mom is waiting for me in the hallway to take me upstairs. I’ll finish it tomorrow (exception please?)

I have updated the code with more features, I would like to add more Levels but i run out of time, i think :smiley:

sigh. Here’s mine. (Also on CC as KickAsteroids.) I pretty much wrote the asset manager on the plane with no internet, so I was super releived when it mostly worked on the airport wifi. I also wish I could use all the time given to finish up what was on my todo list. You can tell which parts of the game was made at the last minute and what wasn’t. :wink:
Anyways, there it is. I’ll be writing a bit about it when I’m in a better situation.

Thanks to all the contestants for sharing their code. I’m only a week or so into Codea and finding it to be a very enjoyable diversion. I look forward to learning from the resident Yodas. Or would that be Yodii?

Codeii, actually :wink:

The locals are friendly

@Mark - can I suggest we keep all the competition entries (plus videos) on a wiki thread, as a guide to what you can do with Codea?

Could you do the same for 50 line challenge? It is a great way to show how easy it is to make games with codea!

Wait for it…

Here is my submission: http://twolivesleft.com/Codea/CC/alpha/index.php?v=1246

(On CC as Turn N’ Fall)

Please those who had a previous version, go to Documents folder and delete TFTut1-10 so it will re-download the latest ones. Sorry for the inconvenience.

The development thread for it is here: http://www.twolivesleft.com/Codea/Talk/discussion/4329/turn-n-fall-codea-cook-off-competition-entry-update-17#Item_72

It’s been great fun, thank you to @Mark for setting it up, and good luck everyone who entered.

Happy New Years! :x

@Ignatz good idea.

Half an hour for those still scrambling.