I am taking a break from the server code to give me sometime to think about how I want to resolve some of the issues that Rob N. @ Bivio software pointed out to me. In the interim, I’ve moved back to the making games theme.
LunarLander – Rough draft Project page
frustrated annoyed at the lack of a simple putPixel like mechanism, but canvasContext2d.arc or rect with a size/width of 1 pixel is a relatively good substitute.
The list is a constant actions function, every tick the logic handler calls each element which is an anonymous function. In Lunar lander I used this to split off the status board in two, key state’s being handled by an anonymous function, while the other stats are handled by the Game logic class itself.
The stack on the other hand will be used for staggered events, one anonymous function being popped off and executed per tick. Some in-efficient idea’s for using it would be for animation effects. Push 10 actions onto the stack, each action drawing say an explosion image frame in progressing fashion.
LunarLander’s logic add’s a hook onto MainLoop’s constant action list and from there its pretty straight forward. Every tick, add a gravity value amount to the Y delta velocity, then add this to the current Y position. If Y is > then the height of the screen, then the lander has crashed/landed.