View Full Version : Point & Shoot Gun
TheKillaCon
06-16-2008, 10:55 PM
Hello, I need the code for a gun (known as "G36c") that points to the cursor ("aim") and when clicked, shoots objects out ("bullet" and "grenade").
Please Help me,
Thanks.
mulletchuck
06-19-2008, 07:46 AM
people aren't going to write your code for you. research methods for making an object/movieClip rotate to always point towards the cursor. it's simple trig.
TheKillaCon
06-19-2008, 07:49 AM
i tried that, using code that worked b4, however it won't work now
mulletchuck
06-19-2008, 07:56 AM
so, post the code, and maybe someone with knowledge will help you.
TheKillaCon
06-19-2008, 08:03 AM
onEnterFrame=function(){
xdif=_root._xmouse-G36c._x;
ydif=_root._ymouse-G36c._y;
angle=(Math.atan(ydif/xdif))/(Math.PI/180);
if(xdif>0){
G36c._rotation=angle+90;
}if(xdif<0){
G36c._rotation=angle-90;
}
}
|
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.