Fizz X

Showcase your libraries, tools and other projects that help your fellow love users.
User avatar
Murii
Party member
Posts: 216
Joined: Fri Jul 05, 2013 9:58 am
Location: Arad, Romania
Contact:

Re: Fizz X

Post by Murii » Thu Oct 29, 2015 6:30 pm

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

User avatar
ivan
Party member
Posts: 1560
Joined: Fri Mar 07, 2008 1:39 pm
Contact:

Re: Fizz X

Post by ivan » Sat Nov 07, 2015 8:13 am

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?

User avatar
Murii
Party member
Posts: 216
Joined: Fri Jul 05, 2013 9:58 am
Location: Arad, Romania
Contact:

Re: Fizz X

Post by Murii » Sat Nov 07, 2015 11:09 am

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.

User avatar
Murii
Party member
Posts: 216
Joined: Fri Jul 05, 2013 9:58 am
Location: Arad, Romania
Contact:

Re: Fizz X

Post by Murii » Sun Nov 08, 2015 5:08 pm

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?

User avatar
ivan
Party member
Posts: 1560
Joined: Fri Mar 07, 2008 1:39 pm
Contact:

Re: Fizz X

Post by ivan » Sun Nov 08, 2015 8:18 pm

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.

User avatar
Murii
Party member
Posts: 216
Joined: Fri Jul 05, 2013 9:58 am
Location: Arad, Romania
Contact:

Re: Fizz X

Post by Murii » Mon Nov 09, 2015 6:42 pm

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.

User avatar
ivan
Party member
Posts: 1560
Joined: Fri Mar 07, 2008 1:39 pm
Contact:

Re: Fizz X

Post by ivan » Fri Apr 29, 2016 8:32 am

Updated to work with the latest version of Love2d.
Includes a few fixes.

User avatar
Gold_Car
Prole
Posts: 27
Joined: Thu Jan 01, 2015 2:07 am

Re: Fizz X

Post by Gold_Car » Thu Nov 16, 2017 3:45 am

Great work, this is really useful!
How do I install it?

User avatar
ivan
Party member
Posts: 1560
Joined: Fri Mar 07, 2008 1:39 pm
Contact:

Re: Fizz X

Post by ivan » Thu Nov 16, 2017 6:38 am

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.

User avatar
Gold_Car
Prole
Posts: 27
Joined: Thu Jan 01, 2015 2:07 am

Re: Fizz X

Post by Gold_Car » Wed Nov 22, 2017 1:59 am

Damn. I had no idea it was that simple.

Thank you.

Post Reply

Who is online

Users browsing this forum: No registered users and 20 guests