[gameprogrammer] Re: need help with bullets....
- From: Olof Bjarnason <olof.bjarnason@xxxxxxxxx>
- To: gameprogrammer@xxxxxxxxxxxxx
- Date: Thu, 14 Apr 2005 12:01:17 +0200
You might have been getting "all or nothing" because you used int's
somewhere instead of floats, or forgetting to convert to float with
(float) ... I've stumbled across that several times before..
Just a thought,
/Olof
On 4/14/05, Anom <adeanom@xxxxxxxxx> wrote:
> 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=3D3D(x,y), you do
> >
> > length =3D3D sqrt(x*x + y*y);
> > x /=3D3D length;
> > y /=3D3D 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 base=
d
> 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
>=20
> --
> Ade Anom A
> [http://www.a3rex.info]
>=20
> ---------------------
> To unsubscribe go to http://gameprogrammer.com/mailinglist.html
>=20
>
---------------------
To unsubscribe go to http://gameprogrammer.com/mailinglist.html
- References:
- [gameprogrammer] need help with bullets....
- From: Anom
- [gameprogrammer] Re: need help with bullets....
- From: Olof Bjarnason
- [gameprogrammer] Re: need help with bullets....
- From: Anom
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] need help with bullets....
- From: Anom
- [gameprogrammer] Re: need help with bullets....
- From: Olof Bjarnason
- [gameprogrammer] Re: need help with bullets....
- From: Anom