Thanks for the help guys, I've managed to move my spaceship based on the direction it's facing
I've posted my updated code for others to maybe learn from
I've added extra keys to control the ships velocity (increase/decrease) and a key to bring the ship to a dead stop.
vel# = 0.2
do
rem get movememt
if keystate(17)=1 rem w pressed --> makes the ship roll clockwise
xang = xang + 5
endif
if keystate(30)=1 rem a pressed --> makes the ship pitch down
yang = yang + 5
endif
if keystate(31)=1 rem s pressed --> makes the ship roll anti-clockwise
xang = xang - 5
endif
if keystate(32)=1 rem d pressed --> makes the ship pitch up
yang = yang - 5
endif
if keystate(44)=1 rem z pressed --> makes the ship turn anti-clockwise
zang = zang + 5
endif
if keystate(45)=1 rem x pressed --> makes the ship turn clockwise
zang = zang - 5
endif
rem ship velocity
if keystate(51) = 1 rem , pressed --> this provides velocity to move the ship
vel# = vel# + 0.2
endif
if keystate(52) = 1 rem . pressed --> this provides velocity to move the ship
vel# = vel# - 0.2
endif
if keystate(57) = 1 rem space bar pressed --> this stops the ship dead!
vel# = 0
endif
if wrapvalue(object angle x(1)) < 55 then xang = 55
if wrapvalue(object angle x(1)) > 340 then xang = 340
rotate object 1, xang,yang,zang
move object 1,vel#
position camera 0,object position x(1),object position y(1)+10,object position z(1) -50
text 0,0, "W/S = roll A/D = pitch Z/X = turn ,/. inc/dec velocity space=all stop"
text 0,10, "Cam X:" + str$(camx)
text 0,20, "Cam Y:" + str$(camy)
text 0,30, "Cam Z:" + str$(camz)
text 0,40, "Angle X:" + str$(wrapvalue(object angle x(1)))
text 0,50, "Angle Y:" + str$(wrapvalue(object angle y(1)))
text 0,60, "Angle Z:" + str$(wrapvalue(object angle z(1)))
text 0,70, "XANG:" + str$(xang)
text 0,80, "YANG:" + str$(yang)
text 0,90, "ZANG:" + str$(zang)
text 0,100, "Speed:" + str$(vel#)
sync
loop
What I need to do next is add some code to restrict the ship rotation in all 3 angles.
Edited: As I noticed I had the keystates & angles the wrong way round - doh!
Marriage is a circle of rings....
Engagement ring, Wedding ring, Suffering!