1

I am trying to create a simple Flappy Bird clone but in my own way ( so it's not a complete clone ).

However I am having problems applying a constant downwards acceleration to the Bird. When I create a World it says that it gets a gravity variable but that's not gravity I think ? It should say something like velocity because that is all it does. My Bird is falling downwards at a constant speed. And I believe most of you know how gravity works. When I use functions like applyForceTo I basically get the same.

I have already my own simple implementation of gravity but I wanna use libGDX to its fullest and practice with it.

J.Doe
  • 125
  • 1
  • 1
  • 10
  • 1
    The physics should express gravity as a constant acceleration in m/sec^2, not velocity. Bodies with mass m that fall without air resistance from initial height y0 and initial velocity v0 under constant gravity g follow the expression y(t) = -(g/2m)*t^2 + v0*t + y0. Forget the code: understand the physics first. – duffymo Jul 05 '18 at 20:12
  • Read [faq] of stackoverflow.com post code. – tgkprog Jul 05 '18 at 20:13
  • 2
    I studied physics but thanks for the lecture. Did you even read my post ? I ALREADY have my own implementation of that, but I am trying to use libGDX functions and objects but they don't do the stuff they're supposed to – J.Doe Jul 05 '18 at 20:17

1 Answers1

0

I found the answer myself and the solution is pretty simple. The objects I render, the whole "System" is way too big for Box2D and its properties to make any difference on the display. Everything accelerates accordingly but you can't see it. So I scaled down every object so it had properties of a couple of pixels and adjusted the camera. Now I can get very high accelerations and velocitys.

J.Doe
  • 125
  • 1
  • 1
  • 10