Thrust and gravity is just mathematical it is best to use the built in commands but sometimes
theres a need to avoid that my lunar lander code is an example without physics not so sure
how well you can follow the code but here it is
#constant KEY_LEFT = 37 //the left arrow key scancode
#constant KEY_RIGHT = 39 //the right arrow key scancode
#constant KEY_SPACE = 32 //the space bar
#constant KEY_ESCAPE = 27 //the escape key used to exit program
#constant swidth =1024
#constant sheight =768
#constant white = MakeColor(255,255,255)
#constant offWhite = MakeColor(200,200,200)
#constant offRed = MakeColor(200,0,0)
#constant green = MakeColor(0,255,0)
#constant black = MakeColor(0,0,0)
#constant scoreTxt =1
#constant timeTxt =2
#constant fuelTxt =3
#constant livesTxt =4
#constant backGround =1
#constant ship =2
#constant timerRed =100
#constant timerGreen =101
#constant fuelRed =102
#constant fuelGreen =103
SetWindowTitle("Lunar Lander" )
SetWindowSize( swidth, sheight, 0 )
SetVirtualResolution( swidth, sheight ) // doesn't have to match the window
SetOrientationAllowed( 1, 1, 1, 1 ) // allow both portrait and landscape on mobile devices
SetSyncRate( 30, 0 ) // 30fps instead of 60 to save battery
SetScissor( 0,0,0,0 ) // use the maximum available screen space, no black borders
UseNewDefaultFonts( 1 ) // since version 2.0.22 we can use nicer default fonts
global thrust#,background_memblock,background_imgwidth,background_imgheight
thrust#=0.1:maxthrust=100:fuel#=100:gravity#=1:score=0:lives=3
landImage=CreateLand()
background_memblock = CreateMemblockFromImage (LandImage)
background_imgwidth = GetMemblockInt(background_memblock, 0)
background_imgheight = GetMemblockInt(background_memblock, 4)
createSprite(background,landImage)
createSprite(ship,CreateCraft(24))
SetSpritePositionByOffset(ship,400,100)
SetSpriteOffset(ship,8,8)
SetSpriteTransparency(ship,1)
CreateTheText()
CreateFuelandTimeBars()
flameY=24:ammount=100:ResetTimer()
repeat
if GetRawKeyState(KEY_SPACE)
if flameY<50
inc flameY
img=GetSpriteImageID(ship)
img2=CreateCraft(flameY)
DeleteImage(img)
SetSpriteImage(ship,img2)
SetSpriteSize(ship,-1,-1)
//SetSpriteOffset(ship,8,GetSpriteScaleY(ship)*.5)
endif
if thrust#<2 then thrust#=thrust#+.1
else
if flameY>24
dec flameY:
img=GetSpriteImageID(ship)
img2=CreateCraft(flameY)
DeleteImage(img)
SetSpriteImage(ship,img2)
SetSpriteSize(ship,-1,-1)
//SetSpriteOffset(ship,8,GetSpriteScaleY(ship)*.5)
endif
if thrust#>0 then thrust#=thrust#-.1
endif
if GetRawKeyState(KEY_LEFT)
SetSpriteAngle(ship,GetSpriteAngle(ship)-1)
endif
if GetRawKeyState(KEY_RIGHT)
SetSpriteAngle(ship,GetSpriteAngle(ship)+1)
endif
if fuel#>0 and timer()<100
angle# = GetSpriteAngle(ship) - 90 //: If angle# < 360 Then angle# = angle# + 360
//Calculate x / velocity based on sprite angle
xvel# = (Cos( angle# ) * (thrust#) )
yvel# = (Sin( angle# ) * (thrust#) )
//move sprite according to its angle and apply a gravity to the y axis
if GetSpriteYByOffset(ship)>20
SetSpritePositionByOffset(ship, GetSpriteXByOffset(ship)+ xvel# ,(GetSpriteYByOffset(ship) + yvel# )+ gravity# )
elseif yvel#>0
SetSpritePositionByOffset(ship, GetSpriteXByOffset(ship)+ xvel# ,(GetSpriteYByOffset(ship) + yvel# )+ gravity# )
endif
else //out of fuel or timer has run out
flameY=20
img=GetSpriteImageID(ship):img2=CreateCraft(flameY):DeleteImage(img)
SetSpriteImage(ship,img2):SetSpriteSize(ship,-1,-1):SetSpriteOffset(ship,8,8)
SetSpritePositionByOffset(ship, GetSpriteXByOffset(ship),GetSpriteYByOffset(ship)+ gravity# )
endif
check=collisionCheck(GetSpriteXByOffset(ship),GetSpriteYByOffset(ship))
if check=3 or timer()>99 //player crashed or timer has expired
lives=lives-1:fuel#=100:ResetTimer()
SetSpritePositionByOffset(ship,400,100)
endif
if check=1 or check=2 //player landed
img=GetSpriteImageID(backGround)
DeleteSprite(backGround)
DeleteImage(img)
hideStuff()
If GetImageExists(landImage) then deleteImage(landImage)
LandImage=CreateLand()
DeleteMemblock(background_memblock)
background_memblock = CreateMemblockFromImage (LandImage)
background_imgwidth = GetMemblockInt(background_memblock, 0)
background_imgheight = GetMemblockInt(background_memblock, 4)
createSprite(1,landImage)
SetSpritePositionByOffset(ship,400,100)
showStuff():fuel#=100
if check=1 then score=score+100 //landed on green
if check=2 then score=score+200 //landed on red
ResetTimer()
endif
fuel#=fuel#-(thrust#/12.0):if fuel#<0 then fuel#=0
SetSpriteSize(fuelGreen,fuel#,20)
SetSpriteSize(timerGreen,100-timer(),20)
SetTextString(scoreTxt,"Score "+str(score))
SetTextString(livesTxt,"Lives "+str(lives))
sync()
until GetRawKeyPressed(KEY_ESCAPE)
function CreateLand()
SetPrintSize(90)
repeat
ClearScreen()
Sync() //sync is needed to reset the print locations to top
landSpots=0
Print(" Lunar Lander")
y1=768
for x = 1 to swidth step 32
y2=random(450,768)
if random(0,5)>0
DrawLine(x,y1,x+32,y2,offWhite,offWhite) //offwhite is used for collision so its different than the lander and title etc
DrawLine(x,y1-1,x+32,y2-1,offWhite,offWhite)
y1=y2
else
if random(0,1)=0
Drawline(x,y1-1,x+52,y1-1,green,green)
Drawline(x,y1,x+52,y1,green,green):x=x+20 //easy landing spot
else
Drawline(x,y1-1,x+32,y1-1,offRed,offRed)
Drawline(x,y1,x+32,y1,offRed,offRed) //harder landing spot
endif
inc landSpots
endif
next x
Render()
until landSpots>=5 //ensures there is atleast 5 landing spots
img = getImage(0,0,swidth,sheight)
endfunction img
function CreateCraft(y as integer)
SetClearColor(0,0,0)
ClearScreen()
//draw craft
DrawBox(0,0,18,16+Y,black,black,black,black,1)
DrawEllipse(8,8,8,8,white,white,0)
DrawLine(3,15,0,24,white,white)
DrawLine(13,15,18,24,white,white)
//drawflame
//DrawLine(4,0,12,0,white,white)
DrawLine(4,16,8,16+y,white,white)
DrawLine(12,16,8,16+y,white,white)
render()
img = getImage(0,0,18,16+Y)
SetImageTransparentColor(img,0,0,0)
endfunction img
function createFuelandTimeBars()
//Time bar two sprites used one for the green and one for the red which is behind the green
//the red bar size changes (getting bigger gradually hiding the green bar
CreateSprite(timerRed,0)
CreateSprite(timerGreen,0)
SetSpriteSize(timerRed,100,20)
SetSpriteSize(timerGreen,100,20)
SetSpriteColor(timerRed,255,0,0,255)
SetSpriteColor(timerGreen,0,255,0,255)
SetSpritePosition(timerRed,118,35)
SetSpritePosition(timerGreen,118,35)
SetSpriteDepth(timerRed,5)
SetSpriteDepth(timerGreen,4)
//Fuel bar two sprites used one for the green and one for the red which is behind the green
//the red bar size changes (getting bigger gradually hiding the green bar
CreateSprite(fuelRed,0)
CreateSprite(fuelGreen,0)
SetSpriteSize(fuelRed,100,20)
SetSpriteSize(fuelGreen,100,20)
SetSpriteColor(fuelRed,255,0,0,255)
SetSpriteColor(fuelGreen,0,255,0,255)
SetSpritePosition(fuelRed,118,65)
SetSpritePosition(fuelGreen,118,65)
SetSpriteDepth(fuelRed,5)
SetSpriteDepth(fuelGreen,4)
endfunction
function CreateTheText()
text1$="Score "
text2$="Time "
text3$="Fuel "
text4$="Lives "
CreateText(scoreTxt,text1$)
CreateText(timeTxt,text2$)
CreateText(fuelTxt,text3$)
CreateText(livesTxt,text4$)
SetTextSize(scoreTxt,30)
SetTextSize(timeTxt,30)
SetTextSize(fuelTxt,30)
SetTextSize(livesTxt,30)
SetTextPosition(scoreTxt,30,0)
SetTextPosition(timeTxt,30,30)
SetTextPosition(fuelTxt,30,60)
SetTextPosition(livesTxt,900,0)
endfunction
function collisionCheck(x,y)
local color1,color2,color3,color4
local collision=0
if x<0 or x>swidth-1 or y<0 or y>sheight-1 then exitfunction collision
color1=pickColor2(x-10,y-10):color2=pickColor2(x+10,y-10)
color3=pickColor2(x-10,y+10):color4=pickColor2(x+10,y+10)
if color1 = offWhite then collision=3 `crashed
if color2 = offWhite then collision=3 `crashed
if color3 = offWhite then collision=3 `crashed
if color4 = offWhite then collision=3 `crashed
if color3 = green or color4 =green
if thrust#>0 and thrust#<1`landed
collision =1
else
collision =3
endif
endif
if color3 = offRed or color4 =offRed
if thrust#>0 and thrust#<1`landed
collision =2
else
collision =3
endif
endif
endfunction collision `return collision value
Function pickColor(X,Y)
local color,img
//color as integer
rem prepare image grab area
clearScreen()
render()
img = getImage(X,Y,X+1,Y+1)
rem create memblock
mem = createMemblockfromImage(img)
rem get memblock data
r = getMemblockbyte(mem,12):rem gets red channel data
g = getMemblockbyte(mem,13):rem gets green channel data
b = getMemblockbyte(mem,14):rem gets blue channel data
rem tidy up
deletememblock(mem)
deleteimage(img)
clearScreen()
color = makeColor(r,g,b)
//color=0
endfunction color
function pickColor2( X, Y)
offset = 12 + (((Y * background_imgwidth) + X) * 4)
r=GetMemblockByte(background_memblock, offset)
g=GetMemblockByte(background_memblock, offset+1)
b=GetMemblockByte(background_memblock, offset+2)
c = MakeColor(r,g,b)
endfunction c
function hideStuff()
SetTextVisible(scoreTxt,0):SetTextVisible(timeTxt,0):SetTextVisible(fuelTxt,0):SetTextVisible(livesTxt,0)
SetSpriteVisible(timerRed,0):SetSpriteVisible(timerGreen,0):SetSpriteVisible(fuelRed,0):SetSpriteVisible(fuelGreen,0)
SetSpriteVisible(ship,0)
endfunction
Function showStuff()
SetTextVisible(scoreTxt,1):SetTextVisible(timeTxt,1):SetTextVisible(fuelTxt,1):SetTextVisible(livesTxt,1)
SetSpriteVisible(timerRed,1):SetSpriteVisible(timerGreen,1):SetSpriteVisible(fuelRed,1):SetSpriteVisible(fuelGreen,1)
SetSpriteVisible(ship,1)
endfunction
dont worry about the memblock code in there as the program uses colors for collision detection just know thats what the getpixelcolor is all about
if you get stuck the thread is here
https://forum.thegamecreators.com/thread/222027?page=2 with allot of other examples most are just
copy paste and run

good luck I wish you well with your projects
fubar