To do something like "trigger once", we can always use a FLAG
When we trigger that event, the FLAG variable will change >> avoid continuous signals sending off... Until you release the space, for instance, the FLAG will return to the normal state that accepts the event again.
so a semi-script will look like...
FLAG=0; //or flag!=1 ...
if (space bar is pressed and FLAG=0) {
Character start jumping;
FLAG=1;
}
so when you pressed SpaceBar, the FLAG will change to 1 and no more jumping is available
It will be good to detect several thing to allow the character to jump again, like return to the ground? SpaceBar is release?... meet both then FLAG=0 again (allow users to jump again)
Originally posted by MKit To do something like "trigger once", we can always use a FLAG
When we trigger that event, the FLAG variable will change >> avoid continuous signals sending off... Until you release the space, for instance, the FLAG will return to the normal state that accepts the event again.
so a semi-script will look like...
FLAG=0; //or flag!=1 ...
if (space bar is pressed and FLAG=0) {
Character start jumping;
FLAG=1;
}
so when you pressed SpaceBar, the FLAG will change to 1 and no more jumping is available
It will be good to detect several thing to allow the character to jump again, like return to the ground? SpaceBar is release?... meet both then FLAG=0 again (allow users to jump again)
Hope it helps
MKit
1169
Man USE YOUR EYE..., the last sentence, I told u to set the Flasg back to 0 AND ALLOW THE CHARACTER to JUMP again... the original problem is continuous triggering, the way to solve is using Flag
Also, Frenzal. In your code you're using = to compare..eg: if(jumping = true) = is the assignment operator. You must use == which is the logical equality comparison.
if(jumping == true){
//do this or that;
}
I have a little Mario-like Jump FLA that you can analyze here .
Last edited by jonwiz; 01-13-2003 at 04:07 PM.
www.jonwiz.com
Drop by for-->MX Component Downloads, Games, Music, Blog, Art & more...