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 »

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: 1911
Joined: Fri Mar 07, 2008 1:39 pm
Contact:

Re: Fizz X

Post 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?
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 »

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 »

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: 1911
Joined: Fri Mar 07, 2008 1:39 pm
Contact:

Re: Fizz X

Post 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.
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 »

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: 1911
Joined: Fri Mar 07, 2008 1:39 pm
Contact:

Re: Fizz X

Post by ivan »

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 »

Great work, this is really useful!
How do I install it?
User avatar
ivan
Party member
Posts: 1911
Joined: Fri Mar 07, 2008 1:39 pm
Contact:

Re: Fizz X

Post 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.
User avatar
Gold_Car
Prole
Posts: 27
Joined: Thu Jan 01, 2015 2:07 am

Re: Fizz X

Post by Gold_Car »

Damn. I had no idea it was that simple.

Thank you.
Post Reply

Who is online

Users browsing this forum: No registered users and 45 guests