Asteroids Bullets Directions?

Blitz3D Forums/Blitz3D Beginners Area/Asteroids Bullets Directions?

Hotshot2005(Posted 2007) [#1]
hiya all,

I am wondering how do you do Bullets directions when the spaceship move around all angle and fire at the same time.

I was thinking of using rotateimage for spaceship and bullets but no it doesnt work.

does anyone could up with simple solutions?

cheers


Hotshot2005(Posted 2007) [#2]
it is 2D game by the way


b32(Posted 2007) [#3]
You could 'prerotate' the images: copy the original ship's image 36 times, and rotate them with steps of 10.
For the projectiles, you could use cos and sin to calculate it's position:
x# = x# + (cos(angle#) * speed#)
y# = y# + (sin(angle#) * speed#)
DrawImage bullet, x#, y#

DrawImage ship, ship_x, ship_y, angle# / 10



Hotshot2005(Posted 2007) [#4]
Thanks B32 =)

cheers