PDA

View Full Version : shooting problem



Mr.Pancake
July 5th, 2005, 09:43 AM
im making some sort of shooting game where u can rotate the guy 360 deg. with your mouse.. so the guy keeps following your mouse...
now my problem is how can i make him shoot?.
if u need the AS here is it for the guy :


onClipEvent (load) {
X = this._x;
Y = this._y;
}
onClipEvent (mouseMove) {
Xm = _parent._xmouse;
Ym = _parent._ymouse;
Xdiff = Xm-X;
Ydiff = Ym-Y;
radAngle = Math.atan2(Ydiff, Xdiff);
this._rotation = radAngle*360/(2*Math.PI);
updateAfterEvent();
}

KIERIOSHIMOTO
July 5th, 2005, 09:51 AM
i have the same problem so helps appreciated...

dinner dog
July 5th, 2005, 10:38 AM
Ok, this was my extreamly quick take on the subject although there would be better ways, but it does work.
all it does is takes the difference that is calculated for the angle of the clip and feeds it to the bullets as speeds.
it must be said that in some directions the bullets do move faster, try it at 5 o'clock then 11 o'clock. So it isn't perfect but it will give you a base.
best of luck

Mr.Pancake
July 5th, 2005, 11:41 AM
whoa.. :} thanks dinner dog

now that those codes are on how can i make him walk in the direction he's facing?


and i also can't make a good hittest for the bullet to hit a enemy
if BULLET hits ENEMY play frame 2 of ENEMY (wich will show him dying)
has this something to do with the duplicate bullets? if someone has a good script or the answer thank you :)