Gravity? Collision Platformer.

BlitzMax Forums/BlitzMax Beginners Area/Gravity? Collision Platformer.

Yes what you really need is X,Y as the position of your object, then XAdd,YAdd as the speed at which it is moving, then you add 2 to the YAdd. Then when you do X:+XAdd and Y:+Yadd it will gradually increase the Y speed as the object falls. Handling collision and bouncing is a little more tricky. When the object hits the surface, depending on the dampening qualitities of the surface the YAdd should be inverted to become negative so the object bounces up the screen. Of course you keep adding 2 to the gravity so it slows down and gradually falls again. But if you want the object to come to a rest eventually you have to lose some of the `energy` when it bounces e.g. YAdd:-10 or something. I also recommend using floats otherwise you'll see quite jagged movement.