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.

2D All the way! / Realistic Gravity for 2D sprite

Author
Message
Boomgate
User Offline
Joined: 15th Feb 2018
Location:
Posted: 15th Feb 2018 08:35

Hi guys, I am making a space ship game where I am trying to fly a space ship... gravity is supposed to drag the ship down, and obviously pressing up will thrust it up... and then when you stop thrust it starts dropping back to the ground... but I find that I cant get it to accelerate, it just goes at a constant speed...

My apologies if this shows up twice, I tried to post it before and it just dissapeared.

blink0k
AGK Developer
5
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 15th Feb 2018 20:21 Edited at: 15th Feb 2018 20:23
Gravity is usually a constant applied to the y value. In your case i would apply it after you get the joystick values ie
c0d3r9
User Offline
Joined: 2nd Oct 2017
Location:
Posted: 18th Feb 2018 14:14
SetSpritePhysicsImpulse and/or SetSpritePhysicsForce if a key is pressed should be the solution i think.
And then you have to play around with the values (SetSpritePhysicsMass too)
JLMoondog
Moderator
9
Years of Service
User Offline
Joined: 18th Jan 2009
Location: Paradox
Posted: 2nd Mar 2018 17:59
Hey Boomgate, try posting in the AppGameKit board next time for a quicker response. I noticed you posted two threads before getting an answer, the 2D board is usually for graphics and not programming. Good luck with your project!

Login to post a reply

Server time is: 2018-06-24 07:51:36
Your offset time is: 2018-06-24 07:51:36