Edit : There are problems with dynamic vs dynamic objects
Edit 2: I fixed the issue adding inside testRectRect() -> if adx >= shw ... then sx = nil sy = nil return end
Murii wrote:Edit : There are problems with dynamic vs dynamic objects
Edit 2: I fixed the issue adding inside testRectRect() -> if adx >= shw ... then sx = nil sy = nil return end
Murii wrote:Edit : There are problems with dynamic vs dynamic objects
Edit 2: I fixed the issue adding inside testRectRect() -> if adx >= shw ... then sx = nil sy = nil return end
Hello Murii, could be please post a code example?
I don't have the original lib any more(I changed things to it) but I remember doing this:
1) I added a "speed" value to vx,vy when I moved: xv = xv + 120 * dt
2) I created a dynamic box(16x16) which in an update method it's vx is set like : box.xv = 120
Then if you try to collide with box you'll see that the response it's not quite good.
Murii wrote:Edit : There are problems with dynamic vs dynamic objects
Edit 2: I fixed the issue adding inside testRectRect() -> if adx >= shw ... then sx = nil sy = nil return end
Hello Murii, could be please post a code example?
Here's my collision detection code: https://gist.github.com/Murii/3bb21946b1821663e705 it works fine but if I add gravity to my dynamic object and collide at top with an static object and then try to move the player, it starts to move extremely fast for unknown reason.Any help?
Murii wrote:if I add gravity to my dynamic object and collide at top with an static object and then try to move the player, it starts to move extremely fast for unknown reason.Any help?
One thing I noticed: make sure the velocity is clamped after you apply gravity.
Also, if you could provide an example of how the velocity is modified in your code it might be helpful.
Usually, when you add velocity to objects, they tend to accelerate continuously.
Murii wrote:if I add gravity to my dynamic object and collide at top with an static object and then try to move the player, it starts to move extremely fast for unknown reason.Any help?
One thing I noticed: make sure the velocity is clamped after you apply gravity.
Also, if you could provide an example of how the velocity is modified in your code it might be helpful.
Usually, when you add velocity to objects, they tend to accelerate continuously.
The problem is that the second when the player touches the floor and I start moving left or right he goes extremely fast and no collision detection is happening. The code can be easily reproduced if you make a dynamic player and add a couple of static boxes pretending they are the floor.
One big problem that can affect this is that the velocity Y is not set to 0.0 when the player touches the floor.It's somewhere around 0.xx or bigger,depending on the gravity value.
Gold_Car wrote: ↑Thu Nov 16, 2017 3:45 am
Great work, this is really useful!
How do I install it?
Thanks, you just need to copy the following three files (fizz.lua, shapes.lua and quad.lua) in your game folder/fizzx: https://bitbucket.org/itraykov/fizzx/sr ... ?at=master
Then you simply require "fizz.lua"
With a little bit of effort, this lib can work quite well for simple, old-school games.