Platformer physics
by Andre Lind · in Torque Game Builder · 07/25/2006 (1:25 am) · 2 replies
Im building a platformer game and I need to know when the player leaves the ground so that I can turn gravity on
If I just enable it when the player jumps it works fine, but I want the to be able to shoot at the enemys and actually move them with the bullets... The bullets have a mass so the enemys move...
However, I need to know when the enemy (or player) leaves the ground
I thought of doing this with triggers along the ground, but should it be a nicer solution if the tiles did the callback?
If I just enable it when the player jumps it works fine, but I want the to be able to shoot at the enemys and actually move them with the bullets... The bullets have a mass so the enemys move...
However, I need to know when the enemy (or player) leaves the ground
I thought of doing this with triggers along the ground, but should it be a nicer solution if the tiles did the callback?
#2
08/01/2006 (8:55 pm)
This is a tricky situation because if you turn gravity off you will stop getting collision callbacks. One way is to do pickRect in an area towards the bottom of the player and see if any of the objects in that rect are "ground". This gets trickier if you're using tile layers because you have to check the collision boxes on individual tiles. It's best not to turn gravity off at all.
Torque Owner Kevin James
May I ask why you don't want the player to be affected by gravity the entire time? It would be much simpler!