Implementing gravity in simple 2d game

前端 未结 1 675
轮回少年
轮回少年 2021-01-16 08:13

I\'m making a simple game, something like mario, with a character fixed in one position, and the ground moving left, giving the illusion of character movement. The ground is

相关标签:
1条回答
  • 2021-01-16 08:44

    Let's see:

    g = 9.8 meters/second
    

    Take height of your character in pixels and match it to an average man height, say 1.7 meters tall.

    Then use gravitation formula:

    y = y0 - g * t^2 / 2
    

    where g is in pixels/second.

    0 讨论(0)
提交回复
热议问题