ActionScript: Throw bullets to mouse direction
After calculating the angle of 2 graphic objects, you can also use this angle to throw a bullet to the object direction with the trigonometry. How ? Calculating the angle (in radian) between 2 graphics objects with the Math.atan2 method (cf. Orient object to the mouse cursor). On click, display a bullet to the “tank” [...]
Posted on Monday December 27th, 2010 at 12:50 PM by admin · Permalink
· 6 Comments
In: ActionScript3 as3, Game Design, Tip, Tutorial · Tagged with: angle, bullet, direction, mouse, radian, shoot em up
In: ActionScript3 as3, Game Design, Tip, Tutorial · Tagged with: angle, bullet, direction, mouse, radian, shoot em up
ActionScript: Orient an object to the mouse cursor
How to orient an objet to an other ? Just put those lines and change the instance name myTank. 12345678910111213141516// This object will always look at the mouse cursor myTank.addEventListener(Event.ENTER_FRAME, tankEnterFrame); // This function will be launched every frame (25 times by seconds); function tankEnterFrame(pEvt) { [...]
Posted on Saturday January 9th, 2010 at 06:17 PM by admin · Permalink
· Leave a comment
In: ActionScript3 as3, Game Design, Tip, Tutorial · Tagged with: actionscript 3, mouse, orientation
In: ActionScript3 as3, Game Design, Tip, Tutorial · Tagged with: actionscript 3, mouse, orientation
