Tracking the Laser Shot
The laser shot moves itself across the screen from its starting point, using the (xmov) and (ymov) variables that the gun set in it when it was created. In this case, there is no collision checking at all. (The next tutorial "Laser Collision Checking" will deal with this)
The laser shot will cease to exist once it moves off the screen. You do this to keep the amount of moving objects as few as possible. Remove everything as soon as you can and your game will run more smoothly. In this case, we enter some actual numbers (the movie is 350x650 pixels .... see Modify > Movie in the Flash menubar. If you chance your movie size, be sure to reflect that here in these numbers.
The Laser Shot asks "Where am I?"
Set Variable: "my_x" = GetProperty("",_x) Set Variable: "my_y" = GetProperty("",_y)
The Laser Shot asks "Am I off the screen?"
If (my_y>(350) or my_y<(0) or my_x>(650) or my_x<(0))
|» Level Advanced|
Rating: 6 Votes: 175
|Flashjunkie is a self-professed obsessive addict of life. Due to the highly artistic nature required of an Art Director for an Ad agency, he took up Flash to add some math to his diet.|
|Download the files used in this tutorial.|
|Download (30 kb)|
|More help? Search our boards for quick answers!|