Hi, im doing a game that have an object Ball. now if the ball
goes out of bounds i want to know so i can remove a life.
the problem is i dont know how to do it. i wrote an if that
checks if the ball is out of bounds but i dont know where to put
where can i iput him so the program will check it all the
To add to klgad, I would create a function that checks the
bounds. Personally, I would use a little different script than you,
but for this case, I will just use your code so you can integrate
it into your fla document.
You also may want to switch to frame labels instead of using
frame numbers as a good habit. So, instead of saying
gotoAndPlay(4), you would use gotoAndPlay("some frame label"). If
you use frame numbers in all your "goto" scripts, if you ever have
to add frames in front, you would have to go back through all your
code and update the new frame numbers. It's just better practice.
Also, without knowing how this game works, you may want to clear
the interval once a ball goes out of bounds by adding
clearInterval(checkBoundsInterval) after your gotoAndPlay() line.
How are you scripting the movement of the ball?