More Navigation and Testing
It seems like there isn't a whole lot to do right now so I'll stick with more testing. I do have a list of things to do, most of which have been done. A few important things would be; User save files for tracking progress and scores, A room-complete splash screen after completing a room, A way for the user to delete a room they created.
Since I had so much fun with the falling blocks title screen background, I wanted to write more about it. BlockPusher game play uses a tween to move a block you push to its destination but for the falling blocks I used physics.
When I first wrote the physics in the update of the FallingBlock class, I used several booleans like willFall and atLimit to stop update from moving the block or increasing speed. I had also made a Number variable called nextY which was part of a calculation to check what would be the next y coordinate of the frame making sure the block wouldn't pass its target coordinate. I realized later that I actually didn't need the booleans or the extra nextY variable and was over complicating the process. The only variables I needed were speed, gravity, terminalVelocity, and targetCoordinate. With those:
override public function update():void
{
if (speed < terminalVelocity)
{
speed += gravity;
if (speed > terminalVelocity) speed = terminalVelocity;
}
if (y < targetCoordinate)
{
if (y + speed >= targetCoordinate)
{
y = targetCoordinate;
// for the green flash:
if (FP.rand(10) < 2) addFlash();
}
}
}
No comments:
Post a Comment