Hey there!
I'm trying to make my physics character able to double-jump but the double-jump should be an attack if an enemy is nearby.
So I check the distance:
Distance(char.x,char.y,enemy.x,enemy.y) < 300 = attack
Distance(char.x,char.y,enemy.x,enemy.y) > 299 = double-jump
Only I can't figure out how to make sure the player jumped before allowing the attack and how to tell when the player is NOT jumping.
I tried setting a variable JustJumped to 1 when I jump, but how can I tell the game the physics character is on the ground to set the var back to 0?... without using insane collision checking on all ground sprite in the level.
Also, If I just walk by an enemy the distance becomes < 300 so my char. attacks instead of jumping.
Any idea?
Also, is it a bad idea to use a physics character. Could I emulate a sonic-like ball destroying physics objects on its way with a platform behavior instead?
Thank you!