Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers AppGameKit Corner / how to gas linke moonlander

Author
Message
Jo Bach
9
Years of Service
User Offline
Joined: 22nd Dec 2014
Location:
Posted: 7th Mar 2015 23:55
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.



The shuttle is 64x64 px (you can use a block to test the code).
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 8th Mar 2015 14:24 Edited at: 8th Mar 2015 14:33
I do it purely with setSpritePhysicsForce()
Apply the force at the X centre of the sprite, and anywhere on the Y axis.
For my game, thrustY# is a value between 0 and 40, based on a frame rate of 60FPS. I increase the thrust value the longet the key is held down, do a maximum of 40.

setSpritePhysicsForce(gShip, shipPosX#,shipPosY#,0,-thrustY#)


This is the result I get (EDIT: Better Video inserted)



Quidquid latine dictum sit, altum sonatur

Login to post a reply

Server time is: 2024-11-21 11:44:47
Your offset time is: 2024-11-21 11:44:47