To do that you need a variable. I'd suggest you create a variable that holds the state of the actor (state).
actor -> KeyDown (up, Repeat) -> Script Editor
- Code: Select all
if(state==0)
{
y=y-9;
}
The above says only when state is zero do you have the actor fly. So, if you want to disable the flying ability, set it to 1.
actor -> Collision (otherActor) -> Script Editor
- Code: Select all
state=1;
Now flying will be disabled. I assume you want to enable it as soon as you touch back on ground, so in your collision with top side of the ground actor, add this.
- Code: Select all
state=0;
This type of variable control will help a lot, when making a game. The idea is pretty simple and very powerful. If you understand this, then you can have many different values for the state variable, and control the actor very precisely.