Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Its Been a While
#1
Its been a really long time scince ive done someting major in QB. so ive decided to work on a Gravity engine for games... that was my first mistake. I realized that Ive only scratched the surface of how to simulate gravity, and now, I need help. any algorythms or formulas would be helpful, thanx :wink:

Mech
the mind is a beautiful thing, use it and make the world a more beautiful place.
Reply
#2
Well, I just have x, y, vx and vy. In each loop, vx gets added to x, and vy gets added to y. If no obstacles, vy increases linearly, simulating gravity: vy = vy + gravity. vy gets a negative boost when player jumps (vy = -jumpStrength), and vx is controled by LEFT and RIGHT keys. This is in my platformers, and it works great.
SCUMM (the band) on Myspace!
ComputerEmuzone Games Studio
underBASIC, homegrown musicians
[img]http://www.ojodepez-fanzine.net/almacen/yoghourtslover.png[/i
Reply
#3
but wouldn't vy stay the same if there is an obstacle (i.e. a platform or the floor)? and when you fall off of something, wouldn't vy become greater until it hits something? btw, vy stands for the Y Vector right?
the mind is a beautiful thing, use it and make the world a more beautiful place.
Reply
#4
vy would be vertical velocity, and it would = 0 if there was no way for the object/player to go down.

*peace*

Meg.
Reply
#5
If course, x = x + vx and y = y + vy are performed only when the player is able to move, i.e. no obstacles in the direction it advances. And Meg's correct: When that happens, v's are reset. I forgot to mention that.l
SCUMM (the band) on Myspace!
ComputerEmuzone Games Studio
underBASIC, homegrown musicians
[img]http://www.ojodepez-fanzine.net/almacen/yoghourtslover.png[/i
Reply
#6
You can get gravity formulas from GORILLAS, which you can get from QBNZ. But although they are correct for predicting gravity, they are slower.
Reply
#7
thanx, i'll have to check that out...
the mind is a beautiful thing, use it and make the world a more beautiful place.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)