PDA

View Full Version : rotate and shoot



kekekiko
January 17th, 2007, 02:37 PM
evenin all

have used the tutorial on simple shooter game to make my own version but was wondering if anyone could advise me on how to get the arrows to shoot in the right direction when the 'hero' rotates their position. I can get the hero to rotate and shoot but the arrow still just goes up the screen rather than follow from where the hero has rotated to.

clear as mud?

SacrificialLamb
January 17th, 2007, 02:58 PM
i used code like this

way = Math.atan2(_ymouse-man._y, _xmouse-man._x)*180/Math.PI;
man._rotation = way+90;
if (mu) {
fire();
}


nam.ang = (man._rotation-90+ag+LR)/180*Math.PI;

this._x += Math.cos(this.ang)*(bul_sp+this.ad);
this._y += Math.sin(this.ang)*(bul_sp+this.ad);
i think that's all of the impotent stuff
full code here http://www.kirupa.com/forum/showthread.php?t=229656
there is also a pontoon shooter some where in this forum that's simpler but i could not find it and have to go to work