I recently asked a question about a function where I would have a property toggled to one if my player is moving. This is is quite similar. I would like to have a property ("In-air") be toggled to one when my player is off the ground. I thought of giving the floor a property called "floor," and when my player is not touching it he cannot jump. I don't know if this is the best way of doing this, but any help is appreciated. I prefer logic bricks if this is simple; otherwise, use python. Thanks!
1 Answer
From the way your question is currently written, I think this is what you want..
When your character is not colliding with the floor, And you press space bar, It will jump. By inverting the output of the collision sensor, you essentially make it send negative pulses when it Is colliding, and send positive pulses when it Is Not
That way the sensor will only register true when it is not colliding with any object with the property floor. activate true level triggering to continuously update the sensor.
-
$\begingroup$ I would use a ray sensor on the -z axis. but... that's just me. $\endgroup$– ruckusCommented Mar 18, 2015 at 23:31
-
$\begingroup$ @X-27 I'm very sorry, I didn't see this answer! I probably opened my notifications when I had a good bit but forgot to check this. What about a, lets just say, ball? Lets say our character is on a ball. Would I have to go and make the top its own piece, and give it a property? $\endgroup$ Commented Mar 24, 2015 at 21:23