Hi All!
I Try to make a shuttle drop from the sky, like moonlander.
It falls perfect with physics.
But when I press the moonlander (or a button) it still falls with this code. No force going up.
How to get the power to go up?
Here is my code, you don't have to give the correct code, but i want to know how to engine the shuttle up (reverse from falling) when pressing it, or a button.
width=320
height=480
SetWindowTitle( "moon_lander" )
SetWindowSize( width,height, 0 )
// set display properties
SetVirtualResolution( width, height )
SetOrientationAllowed( 1, 1, 0, 0 )
CreateSprite(2,LoadImage("backGround1.png"))
CreateSprite(1,LoadImage("raket.png"))
SetSpritePhysicsOn(1,2)
sy#=0
do
if (GetPointerPressed()=1)
sy#=sy#-1
SetPhysicsForcePower(1,10)
else
sy#=0
endif
SetSpritePhysicsForce(1,0,10,0,sy#)
` SetSpritePhysicsVelocity(1,0,sy#)
`SetSpritePhysicsImpulse
`SetSpritePosition(1,GetSpriteY(1)+sy#,0)
`SetSpritePhysicsImpulse(1,1,1,-100,-100)
SetSpritePhysicsForce(1,1,101,-100,-100)
Print( GetSpriteY(1) )
Sync()
loop
The shuttle is 64x64 px (you can use a block to test the code).