Monday, August 5, 2013

flea circus

Copperbox revision 2996.

Move the Lua code (flea_motion and flea_circus)  into the directory art_sound/lua.


Copperbox revision 2997.

mcommand - experiment with Missile Command (cursor!) style player control.


Side Note

Sadly my application to Light Night has been turned down - so work has stopped on the flea circus. Back to Haskell...

Sunday, August 4, 2013

flea circus

Copperbox revision 2994.

I've reworked the flea stack so it grows only from the top. This means that a fair amount of game play is now "working". It also illustrates that the current game play isn't up to scratch - I'm still going to need a lot of design work.

Update - revision 2995.

Minor changes to the player speed to reduce the arc of a jump. 

Saturday, August 3, 2013

flea circus

Copperbox revision 2993.

I've fixed some glitches where the stack of fleas wasn't being animated. Most heinously was I was calling self.play('...') rather than self:play('...') - the former causes a silent fail. Also I had some issues calling self (or not) in the class constructors.


Thursday, August 1, 2013

Lua angst

Tonight I needed to use the Lua interpreter (mostly I run from Love) and it seems that Lua for Windows hadn't set an inadequate path when it installed.

The environment variable LUA_PATH in the control panel was just "C:\Program Files\lua\5.1\lua" but this means the Lua interpreter won't be able to load modules in the current directory when used interactively.

I had to prefix the path with "?;?.lua" - i.e. "?;?.lua;C:\Program Files\Lua\5.1\lua"

Question mark is the wildcard for Lua, the interpreter swaps it for the module name. Semicolon is the "path" separator, though apparently Lua doesn't have much of a notion of paths.


I couldn't find mention of this problem through various frustrated web searches, so I'm posting it here. I expect all Lua coders already know that the LUA_PATH should include "?;?.lua".


Tuesday, July 30, 2013

flea circus

Copperbox revision 2992.

I've added a subclass for the flea stack - the first level of the game (there might only be one) has the player jumping on to a stack of fleas to make a tower (c.f circus acrobats).

The flea stack is a specialized Group - unfortunately it seems I have to make a subclass of Group (and inherit a big API) rather than wrap a Group as an instance variable of a new class. If I wrap Group, the flea stack appears to miss some draw event fired in the framework which leaves it invisible.

Monday, July 29, 2013

flea circus

Copperbox revision 2991.

Slaps forehead, Homer Simpson style...

The problem with the flea player not picking up simultaneous jump and left / right arrow key presses was entirely self-inflicted and not due to a slow computer.

The old code merged all key press detection into one multiway if statement:
if the.keys:pressed("left") then
    self:walkLeft()
elseif the.keys:pressed("right") then
    self:walkRight()
elseif the.keys:pressed(" ") then
    playSound('jump.ogg')
    self:jumpAction()
end
The solution is to group exclusive key presses together (left | right) but use separate if statements for independent actions (jump):
if the.keys:pressed("left") then
    self:walkLeft()
elseif the.keys:pressed("right") then
    self:walkRight()
end

-- We can detect more then one key press per frame if we
-- don't nest them within the same if-elseif ... statement
if the.keys:pressed(" ") then
    playSound('jump.ogg')
    self:jumpAction()
end
Annoyingly I was aware of this idiom as the player control has had it before, but it got removed in a frustrated bout of hacking. This obviates the need for yesterdays Pachinko inspired player control.

Sunday, July 28, 2013

flea circus

Copperbox revision 2990.

I've added another control / motion experiment - Pachinko.

In a nutshell, it seems that holding down the left or right arrows for constant motion is not going to work. So I need a new control strategy that uses singular key presses. Pachinko seems like a good model - start the flea off with maximum velocity and let its acceleration very slowly decay to zero. Jumping is still controlled by a key press (so there is some deviation from Pachinko), but left or right direction is determined by the initial motion and collisions rather than user action.

Blog Archive

About Me

My photo
Disambiguating biog as there are a few Stephen Tetley's in the world. I'm neither a cage fighter or yachtsman. I studied Fine Art in the nineties (foundation Bradford 1992, degree Cheltenham 1992 - 95) then Computing part-time at Leeds Met graduating in 2003. I'm the Stephen Tetley on Haskell Cafe and Stackoverflow.