Bug in love.physics, or bad coding ???
Posted: Tue Apr 12, 2016 12:44 pm
Hello all,
I am learning Löve & Lua (working with love 10.1), and I have a strange behavior in one of my tests...
I created a ball (associated with an image), a ground and a floor (width: 1/3 of the window, in the middle of the window).
When pressing the space bar, the ball has a vertical kick and goes up. When pressing left or right arrows, the ball goes in the direction of the arrow.
(see attached .love file for the code)
Now, the bug I suspect:
When I start the game, I press one or 2 times (or 3 !) to bring the ball on the floor. Once on the floor, I let the ball few seconds without any move (to "stabilize"). Then I move horizontally with the arrows.
***** the bug ****
sometimes (often..), the ball has no gravity anymore. It stays at the height of the floor, and does not fall on the ground.
when giving a new kick, the ball (if not above the floor) has a "normal" behavior (falling on the ground)
***** bug correction **** (but ugly solution...)
when moving horizontally, I add an impulse to the bottom (with very low impulse: 0.01)
(you can test it by enabling the "correction mode" with up arrow (sorry, I haven't added a debounce mode..)
The strange thing is that if I activate the "correction mode" once, then I haven't the bug anymore...
Now my question:
Did I made a mistake in coding, or is it a bug from love.physics (or is there a ghost in my computer...) ?????
Thanks for your answers
Apatbol
I am learning Löve & Lua (working with love 10.1), and I have a strange behavior in one of my tests...
I created a ball (associated with an image), a ground and a floor (width: 1/3 of the window, in the middle of the window).
When pressing the space bar, the ball has a vertical kick and goes up. When pressing left or right arrows, the ball goes in the direction of the arrow.
(see attached .love file for the code)
Now, the bug I suspect:
When I start the game, I press one or 2 times (or 3 !) to bring the ball on the floor. Once on the floor, I let the ball few seconds without any move (to "stabilize"). Then I move horizontally with the arrows.
***** the bug ****
sometimes (often..), the ball has no gravity anymore. It stays at the height of the floor, and does not fall on the ground.
when giving a new kick, the ball (if not above the floor) has a "normal" behavior (falling on the ground)
***** bug correction **** (but ugly solution...)
when moving horizontally, I add an impulse to the bottom (with very low impulse: 0.01)
(you can test it by enabling the "correction mode" with up arrow (sorry, I haven't added a debounce mode..)
The strange thing is that if I activate the "correction mode" once, then I haven't the bug anymore...
Now my question:
Did I made a mistake in coding, or is it a bug from love.physics (or is there a ghost in my computer...) ?????
Thanks for your answers
Apatbol