Creating Gravity

BlitzMax Forums/BlitzMax Beginners Area/Creating Gravity

A51M15X(Posted 2009) [#1]
I have some really basic gravity set up using TranslateEntity, but i want to set up something that speeds up when the distance you fall is greater. And another thing I want to make my character jump, but it looks as if im teleporting into the air when i jump instead of smoothly jumping.


_Skully(Posted 2009) [#2]
All you have to do is keep deltaX:float and deltaY:float values

Gravity is just the deltay increasing by an appropriate amount per game tick

Real gravity is 9.8 M/S^2... in other words 9.8meters/second gets applied to the deltaY value... deltaY=deltaY+9.8 each game tick... of course that value would be absurd from a game perspective but hopefully that helps.


A51M15X(Posted 2009) [#3]
I know what your talking about, but i have no idea how to put that in code. (I just bought Blitz3D yesterday.)


plash(Posted 2009) [#4]
(I just bought Blitz3D yesterday.)
You're in the wrong section!

http://www.blitzbasic.com/Community/topics.php?forum=5


_Skully(Posted 2009) [#5]
Indeed...

However, consider...

graphics 800,600
PlayerX#=0
PlayerY#=0
Playerdx#=0
playerdy#=0

While not keydown(1)
  dy=dy+0.098  ; acceleration
  PlayerY=PlayerY+dy ; movement
  plot PlayerX,PlayerY
Wend