Page 8 of 9

Re: Fizz X

Posted: Thu Oct 29, 2015 6:30 pm
by Murii
ivan wrote:Very crude HTML5/JS port of the basic functionality of Fizz:
http://2dengine.com/doc/tutorials/html5/index.html
Based on the tutorial:
http://2dengine.com/doc/gs_collision.html
Thanks for the tutorial! It's extremely helpful!

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

Re: Fizz X

Posted: Sat Nov 07, 2015 8:13 am
by ivan
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?

Re: Fizz X

Posted: Sat Nov 07, 2015 11:09 am
by Murii
ivan wrote:
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.

Re: Fizz X

Posted: Sun Nov 08, 2015 5:08 pm
by Murii
ivan wrote:
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?

Re: Fizz X

Posted: Sun Nov 08, 2015 8:18 pm
by ivan
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?
The code looks ok.

Code: Select all

      d.xv, d.yv  = clampVec(d.xv, d.yv, d.maxVelocity)
      d.yv = d.yv + d.gravity
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.

Re: Fizz X

Posted: Mon Nov 09, 2015 6:42 pm
by Murii
ivan wrote:
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?
The code looks ok.

Code: Select all

      d.xv, d.yv  = clampVec(d.xv, d.yv, d.maxVelocity)
      d.yv = d.yv + d.gravity
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.
http://www.pasteall.org/62126/lua

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.

Re: Fizz X

Posted: Fri Apr 29, 2016 8:32 am
by ivan
Updated to work with the latest version of Love2d.
Includes a few fixes.

Re: Fizz X

Posted: Thu Nov 16, 2017 3:45 am
by Gold_Car
Great work, this is really useful!
How do I install it?

Re: Fizz X

Posted: Thu Nov 16, 2017 6:38 am
by ivan
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.

Re: Fizz X

Posted: Wed Nov 22, 2017 1:59 am
by Gold_Car
Damn. I had no idea it was that simple.

Thank you.