Simple Cannon Game
This example uses a lot of trigonometry to fire bullets from a cannon. Actionscript is used to rotate the cannon barrel to the mouse position, determine distances (which dictates firing power), create vectors for bullets being fired as well as rotate bullets in the direction their moving while in the air. Hittest is used to check for a bullets collision on the target at which point the target is placed at another random position on the screen.
advertisement