Try this - implemented the idea from what Hoyoyo80 trying to achieve and a little more to help you
global speedX# as float
global speedY# as float
global width = 1024
global height = 768
global rotate# = 0
global boosterx# = 0
global boostery# = 0
global x
global y
global playerspeed# = 0.05
global maxstardistance=10
#constant maxstars=500
// set display properties
SetVirtualResolution( width, height )
SetOrientationAllowed( 1, 1, 1, 1 )
LoadImage (1, "player.png" )
createsprite(1,1)
LoadImage (2, "boost.png" )
createsprite(2,2)
// Create some stars
type _stars
x# as float
y# as float
size# as float
distance# as float
endtype
global stars as _stars[maxstars]
setupplayer()
setupstars()
Do
// Draw sprites
displaystars()
// Position the player and booster
accx#=getspritex(1) + speedy# * cos(90-rotate#)
accy#=getspritey(1) - speedy# * sin(90-rotate#)
setspriteposition(1,accx#,accy#)
setspriteposition(2,getspriteX(1) +boosterx#, getspriteY(1) + boostery#)
// RIGHT
if GetRawKeyState(37)
rotate#=rotate#-1
//speedX#=speedX#+0.1
endif
// LEFT
if GetRawKeyState(39)
rotate#=rotate#+1
//speedX#=speedX#-0.1
endif
// UP
if GetRawKeyState(38)
speedY#=speedY#+playerspeed#
SetSpriteVisible(2,1)
else
SetSpriteVisible(2,0)
endif
// DOWN
if GetRawKeyState(40)
speedY#=speedY# - playerspeed#
endif
// SPACE
if GetRawKeyState(81)
updatestarsdistance(1)
endif
if GetRawKeyState(65)
updatestarsdistance(2)
endif
// Check bounderies and reset to the other side of the screen - so sprite
// doesnt get lost into the eeeeetha
if getspritex(1)<0 then SetSpritePosition(1, width, getspritey(1))
if getspritex(1)>width then SetSpritePosition(1, 0, getspritey(1))
if getspritey(1)<0 then SetSpritePosition(1, getspritex(1), height)
if getspritey(1)>height then SetSpritePosition(1, getspritex(1), 0)
// Bit of rotation too if you like it
if rotate#<-360 then rotate#=0
if rotate#>360 then rotate#=0
// We now need to move the sprite to the correct angle of the space ship - so it doesnt
// look wierd - rather then cool
// Try with and without so see what i mean
boosterx# = -(GetSpriteWidth(1)) * -cos (270-rotate#)
boostery# = (GetSpriteHeight(1)) * -sin (270-rotate#)
//
// Set the angle for player and the booster
SetSpriteAngle ( 1, rotate#)
SetSpriteAngle ( 2, rotate#)
// Press a key and will show you the Asci code - Usewful when wanting to check for the keypresses
// and what key is what, uncomment if want to use
// print (GetRawLastKey())
print ("Press 'Q and A' to change the depth into space")
sync()
loop
function displaystars()
for temp=1 to maxstars
stars[temp].x#=stars[temp].x# - speedy#/(stars[temp].distance#*2) * cos(90-rotate#)
stars[temp].y#=stars[temp].y# + speedy#/(stars[temp].distance#*2) * sin(90-rotate#)
if stars[temp].x# < 0 then stars[temp].x# = width
if stars[temp].x# > width then stars[temp].x# = 0
if stars[temp].y# < 0 then stars[temp].y# = height
if stars[temp].y# > height then stars[temp].y# = 0
if stars[temp].size#<0.01 then stars[temp].size#=0.01
if stars[temp].size#>20
stars[temp].x#=random(1,width)
stars[temp].y#=random(1,height)
stars[temp].distance#=random(1,5)
stars[temp].size# = stars[temp].distance#
endif
DrawLine(stars[temp].x#,stars[temp].y#, stars[temp].x#+stars[temp].size#, stars[temp].y#, val("ffffff",16), val("ffffff",16))
DrawLine(stars[temp].x#+stars[temp].size#/2,stars[temp].y#-stars[temp].size#/2, stars[temp].x#+stars[temp].size#/2, stars[temp].y# + stars[temp].size#/2, stars[temp].y#+ stars[temp].size#/2, val("ffffff",16), val("ffffff",16))
next
endfunction
function setupstars()
for temp=1 to maxstars
stars[temp].x# = random(1,width)
stars[temp].y# = random(1,height)
stars[temp].distance#=random(1,5)
stars[temp].size# = random(0,stars[temp].distance#)
next
endfunction
function updatestarsdistance(way as integer)
for temp=1 to maxstars
if stars[temp].distance#<maxstardistance or stars[temp].distance#>0.1
if way = 1 then stars[temp].size# = stars[temp].size# + stars[temp].distance#/50
if way = 2 then stars[temp].size# = stars[temp].size# - stars[temp].distance#/50
endif
next
endfunction
function setupplayer()
x=440
y=200
// Set the starting positions of the player and the booster
SetSpritePosition(1, x, y )
SetSpritePosition(1, x, y+GetSpriteHeight(1))
//SetSpriteAngle(1,180)
SetSpriteAngle(2,180)
endfunction
Added a little boost image to it too, create like a flame that comes out of a rocket when accellerates or such like first and call it boost.png
f like anymore help with anything, give us a shout
perhaps create a sprite that looks like a star and replace the drawline commands (that create the star) with setspritesize commands
Hope it helps
Enjoy!!
Damo
Using Tier 1 AppGameKit V2
Started coding with AMOS
Anything is possible if put mind to it