[gameprogrammer] Re: need help with bullets....
- From: Anom <adeanom@xxxxxxxxx>
- To: gameprogrammer@xxxxxxxxxxxxx
- Date: Thu, 14 Apr 2005 16:30:45 +0700
On 4/14/05, Olof Bjarnason <olof.bjarnason@xxxxxxxxx> wrote:
>
> Let F be the for ship position, and P be the player ship position.
>
> 1. Find the vector from F to P and normalize it. (divide each
> coordinate it by the vector's length), call it A
> 2. Decide a speed for the bullet, BULLET_SPEED.
> 3. Each time you update the shot, add A*BULLET_SPEED to the current
> position of the shot
>
> To normalize a vector A=3D(x,y), you do
>
> length =3D sqrt(x*x + y*y);
> x /=3D length;
> y /=3D length;
>
> This kind of math is called Vector Algebra and you're gonna read a lot
> of it at college / uni.. Or beforehand which is more fun :)
>
>
weird... last time before i post my question, i have try this vector based
solution and what i get is, the bullet stay put or else just going to the
top of the window....
but know... it's fine.... i guess i have miss something here. but thx
Olof....
guess it's my fault for not good at math since high school :p
--
Ade Anom A
[http://www.a3rex.info]
---------------------
To unsubscribe go to http://gameprogrammer.com/mailinglist.html
- Follow-Ups:
- [gameprogrammer] Re: need help with bullets....
- From: Olof Bjarnason
- References:
- [gameprogrammer] need help with bullets....
- From: Anom
- [gameprogrammer] Re: need help with bullets....
- From: Olof Bjarnason
Other related posts:
- » [gameprogrammer] need help with bullets....
- » [gameprogrammer] Re: need help with bullets....
- » [gameprogrammer] Re: need help with bullets....
- » [gameprogrammer] Re: need help with bullets....
- » [gameprogrammer] Re: need help with bullets....
- » [gameprogrammer] Re: need help with bullets....
- [gameprogrammer] Re: need help with bullets....
- From: Olof Bjarnason
- [gameprogrammer] need help with bullets....
- From: Anom
- [gameprogrammer] Re: need help with bullets....
- From: Olof Bjarnason