Saturday, August 2, 2008

Hooking up keyboard control

Today's goal is getting the pucks to move. I've set up a new test suite and thrown in a test tailored to make sure input frames results in non-zero velocity. So, I create a mock puck class that befriends the test, and then just asserting that sending a "left" input frame gives a velocity change. To do this, I have to step the puck manually, but Chipmunk generously provides cpBodyUpdateVelocity to do that.

...and there we have it. One puck moving around under keyboard influence!

No comments: