GLBasic forum

Main forum => GLBasic - en => Topic started by: WAAAAAA on 2006-Aug-02

Title: Bullets
Post by: WAAAAAA on 2006-Aug-02
im making a 2d game with space ships ur on  the bottom enemies top standard stuff how do i make the bullets go on an angle sorta thing? would i have to use the angle commands im not that good with them could u help me?
Title: Bullets
Post by: Gloomberg on 2006-Aug-03
You can use the simple Geometry. If x is the bullets's x coordinate and y its y coordinate? a - its an angle, at which you want to turn your bullet, and speed is just a bullet speed:
Code (glbasic) Select
x=x+sin(a)*speed
y=y+cos(a)*speed
ROTOSPRITE bullet,x,y,a