Ideas regarding flow control and loops

Marco Aurélio thecoreh at gmail.com
Sat Nov 3 13:12:16 PDT 2007


Daniel Keep Wrote:
> else would also be nice.

This would be specially usefull for implementing collisions on 2D games with bitmap-based coldefs, something along the lines of:

while(object.isCollidingWithGround())
{
     object.moveUp();
} finally {
     object.stop();
} else {
     object.applyGravity();
}

While the object is colliding with the ground, move it up... Then stop it.. and if he wasn't colliding with the ground in the first place, apply gravity.



More information about the Digitalmars-d mailing list