Search Tutorials
The Variables To Be Added On top of the code that was built in the last tutorial here are some more variables for the main timeline that are needed for the gun:
Set Variable: "/gun:shootchance" = 12
Set Variable: "shotspeed" = 15
Comment: ----------------------------------------------
Start Drag ("/ship", lockcenter)
"shootchance" is a variable that the gun will consult to see what percentage of the time (out of 100) it should be shooting. This depends on how much code is running at any one time in your Flash game. If you have lots and lots of code, it will take the game a while to get around to testing if it should shoot. If this is the case, you may want to set the shootchance higher. If there is nothing else running (like in the tutorial above) EVEN if you set "shootchance" very low... it still shoots almost constantly I have created a target for the gun to shoot at. The target is called "ship". I start a drag so that the gun will constantly shoot at your mouse for this demo.
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
![]() |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|