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.
Tuesday, July 30, 2013
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:
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() endThe 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() endAnnoyingly 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.
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.
Saturday, July 27, 2013
flea circus
Copperbox revision 2989.
I've got the basics of the first level working - the player jumps on top of a growing "acrobat stack" of fleas.
As my dev computer is ancient, it's hard to get a feel of whether the player control of the flea is going to be satisfactory. Maybe I should have picked clowns on unicycles - harder to animate but easier to control....
I've got the basics of the first level working - the player jumps on top of a growing "acrobat stack" of fleas.
As my dev computer is ancient, it's hard to get a feel of whether the player control of the flea is going to be satisfactory. Maybe I should have picked clowns on unicycles - harder to animate but easier to control....
Thursday, July 25, 2013
skeletons.ps - a PostScript doodle with iteration skeletons
% Stroked circle % follows the idiom of builtin arc where X Y are parameters % (i.e. not the ~moveto~ then ~show~ idiom of text) % /SCIRC % X Y R SCIRC { /R exch def /Y exch def /X exch def newpath X Y R 0.0 360.0 arc closepath stroke } bind def % Font load /FL % SZ NAME FL { findfont exch scalefont setfont } bind def % HREPEAT /HREPEAT % N X Y DX PROC { /PROC exch def /DX exch def /Y exch def /X exch def /N exch def N { X Y PROC X DX add /X exch def } repeat } bind def % VREPEAT /VREPEAT % N X Y DY PROC { /PROC exch def /DY exch def /Y exch def /X exch def /N exch def N { X Y PROC Y DY add /Y exch def } repeat } bind def % XFORALL /XFORALL % X Y DX ARR PROC { /PROC exch def /ARR exch def /DX exch def /Y exch def /X exch def ARR { /A1 exch def X Y A1 PROC X DX add /X exch def } forall } bind def % YFORALL /YFORALL % X Y YX ARR PROC { /PROC exch def /ARR exch def /DY exch def /Y exch def /X exch def ARR { /A1 exch def X Y A1 PROC Y DY add /Y exch def } forall } bind def % XYSHOW /XYSHOW % X Y STR { /STR exch def /Y exch def /X exch def X Y moveto STR show } bind def % APPLY2 - apply a procedure taking 2 arguments to an % array with 2 elems (pair) /APPLY2 % ARR PROC APPLY2 { /PROC exch def /ARR exch def /S1 ARR 0 get def /S2 ARR 1 get def S1 S2 PROC } bind def gsave 12 /Helvetica FL gsave 5 100 100 20 { 5 SCIRC } HREPEAT 10 100 200 15 { /Y exch def /X exch def X Y moveto (o) show } HREPEAT 7 300 100 15 { (A) XYSHOW } VREPEAT 300 300 50 [5 10 15 20] { SCIRC } XFORALL 100 300 -15 [(1) (2) (3) (4)] { XYSHOW } YFORALL grestore showpage
Wednesday, July 24, 2013
PostScript (higher order)
Code is a first class citizen in PostScript. The builtin repeat and forall operators are obvious consumers of code (procedures) but it is also easy to define your own higher order skeletons. For instance the code example at the bottom defines hrepeat as used by Wumpus.
For efficiency reasons I'd like a successor to Wumpus to allow users to create their own drawing procedures, and iterating these drawing procs should be possible in PostScript (rather than having to unroll the iteration skeletons during "compilation" leading to code bloat).
For efficiency reasons I'd like a successor to Wumpus to allow users to create their own drawing procedures, and iterating these drawing procs should be possible in PostScript (rather than having to unroll the iteration skeletons during "compilation" leading to code bloat).
% Stroked circle % follows the idiom of builtin arc where X Y are parameters % (i.e. not the ~moveto~ then ~show~ idiom of text) % /SCIRC % X Y R SCIRC { /R exch def /Y exch def /X exch def newpath X Y R 0.0 360.0 arc closepath stroke } bind def % Font load /FL % SZ NAME FL { findfont exch scalefont setfont } bind def % HREPEAT /HREPEAT % N X Y DX PROC { /PROC exch def /DX exch def /Y exch def /X exch def /N exch def N { X Y PROC X DX add /X exch def } repeat } bind def gsave 12 /Helvetica FL gsave 5 100 100 20 { 5 SCIRC } HREPEAT 10 100 200 15 { /Y exch def /X exch def X Y moveto (o) show } HREPEAT grestore showpage
Monday, July 22, 2013
flea circus
Copperbox revision 2988.
More work on flea motion.
I think I'm happy that this code models how I want the flea motion to be controlled and the code is clear enough (although the model is simplified as it doesn't yet account for collisions).
There are a couple of intrinsics to the motion that are now captured:
* Fleas should walk left (or right) with the arrow keys pressed. After the arrow is release there is still some residual forward motion until the flea decelerates.
* Jumping should account for the speed/direction at the point of the jump key-press. During the jump - pressing arrow keys has no influence, i.e. control is like a long jump (rather than a jet-pack!).
More work on flea motion.
I think I'm happy that this code models how I want the flea motion to be controlled and the code is clear enough (although the model is simplified as it doesn't yet account for collisions).
There are a couple of intrinsics to the motion that are now captured:
* Fleas should walk left (or right) with the arrow keys pressed. After the arrow is release there is still some residual forward motion until the flea decelerates.
* Jumping should account for the speed/direction at the point of the jump key-press. During the jump - pressing arrow keys has no influence, i.e. control is like a long jump (rather than a jet-pack!).
Sunday, July 21, 2013
flea circus
Copperbox revision 2987.
More work on flea motion - I've started a sandbox project just for this (art_sound/flea_motion).
Motion (direction, acceleration, velocity) is quite complicated to reason about, I'll have to encapsulate it into some kind of state machine. I'm missing algebraic datatypes in Lua.
More work on flea motion - I've started a sandbox project just for this (art_sound/flea_motion).
Motion (direction, acceleration, velocity) is quite complicated to reason about, I'll have to encapsulate it into some kind of state machine. I'm missing algebraic datatypes in Lua.
Sunday, July 14, 2013
ochre-redux
Copperbox revision 2986.
A new experiment remaking the Ochre / Orca monad so it is more comfortable for developing DX7 style algorithms.
The many feature is a kind of late binding implemented via type classes, this intends to regularize the input parameters to components (so they can be composed) - and hide some of the tedious details (such as the table number references needed by FM phasors).
A new experiment remaking the Ochre / Orca monad so it is more comfortable for developing DX7 style algorithms.
The many feature is a kind of late binding implemented via type classes, this intends to regularize the input parameters to components (so they can be composed) - and hide some of the tedious details (such as the table number references needed by FM phasors).
Monday, July 1, 2013
om-shell
Copperbox revision 2985.
Work on a more component style of implementing configuration algorithms.
Configuration algorithm - a block diagram linking operators, where an operator is a signal generator or a signal transformer (implemented with one or more Ugens).
Component style - operators are addressable components with input and output ports. Chaining processors on these ports (e.g adding delay, echo, ...) should be allowed.
Previously a large record was used for all the parametrization of an algorithm which hindered customization with (standard) reusable processors.
Work on a more component style of implementing configuration algorithms.
Configuration algorithm - a block diagram linking operators, where an operator is a signal generator or a signal transformer (implemented with one or more Ugens).
Component style - operators are addressable components with input and output ports. Chaining processors on these ports (e.g adding delay, echo, ...) should be allowed.
Previously a large record was used for all the parametrization of an algorithm which hindered customization with (standard) reusable processors.
Subscribe to:
Posts (Atom)
Blog Archive
About Me
- Stephen Tetley
- 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.