Tutorials, extensions, and source files for ActionScript, Flash, and other Adobe products.


Flash Source Files

Simple Cannon Game

Posted May 20, 2004 by senocular

Version: Flash MX

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.