Being relatively new to both Lua and Love, collisions and whatnot have always kinda confused me. I've made a map with Tiled, and am loading it with STI, I have no clue how to make a working "player" so I've been using this: viewtopic.php?f=4&t=80684
However, the "player" doesn't collide with my map, so I started looking into bump.lua, only problem is, I have no idea how to make my "player" abide by bump.lua's 'rules'. If someone could show me how this might be possible, that would be wonderful.
If possible, I'd also appreciate if someone could give an example of implementing gravity, and jumping, currently, my player is free-floating around the screen.
Help with Collisions, bump.lua, and STI
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
- TheScout18
- Prole
- Posts: 10
- Joined: Tue Aug 25, 2015 2:12 am
Help with Collisions, bump.lua, and STI
- Attachments
-
- Game.love
- w,a,s,d to move
- (173.56 KiB) Downloaded 139 times
Ubuntu is pretty cool!
http://www.ubuntu.com
http://www.ubuntu.com
Re: Help with Collisions, bump.lua, and STI
Did you read bump.lua's documentation?
you need to use world:move before actually moving your player to check for and handle collisions.
you need to use world:move before actually moving your player to check for and handle collisions.
- TheScout18
- Prole
- Posts: 10
- Joined: Tue Aug 25, 2015 2:12 am
Re: Help with Collisions, bump.lua, and STI
Ah! I'd only read the "README" thanks, this has a lot more detail, however, the way it explains handling collisions is rather complicated... And I'm still having my player float right through what I thought I had defined as a solid block. Perhaps an example of sorts would be handy?
(attached the changed version of my game)
(attached the changed version of my game)
- Attachments
-
- Game.love
- (173.65 KiB) Downloaded 115 times
Ubuntu is pretty cool!
http://www.ubuntu.com
http://www.ubuntu.com
Re: Help with Collisions, bump.lua, and STI
That is also the Readme file, you just need to scroll. There is also a small examples at the beginning and there are two larger examples as separate branches of the got repo. Did you read the whole README now?TheScout18 wrote:Ah! I'd only read the "README" thanks, this has a lot more detail, however, the way it explains handling collisions is rather complicated... And I'm still having my player float right through what I thought I had defined as a solid block. Perhaps an example of sorts would be handy?
(attached the changed version of my game)
- TheScout18
- Prole
- Posts: 10
- Joined: Tue Aug 25, 2015 2:12 am
Re: Help with Collisions, bump.lua, and STI
Oh wow, I feel kinda dumb now, lol. Yes, I've now read it all, but am still not quite grasping the collision handling...
Ubuntu is pretty cool!
http://www.ubuntu.com
http://www.ubuntu.com
Re: Help with Collisions, bump.lua, and STI
All you need to do is calculate where the player "wants" to go, and then give that to world:move. It will return new x and y coordinates for the position that the player will end up in, after colliding with all the stuff that is around. If you want to trigger additional actions based on the collisions, you can look at the other values returned by the function.TheScout18 wrote:Oh wow, I feel kinda dumb now, lol. Yes, I've now read it all, but am still not quite grasping the collision handling...
Which part is unclear to you?
- TheScout18
- Prole
- Posts: 10
- Joined: Tue Aug 25, 2015 2:12 am
Re: Help with Collisions, bump.lua, and STI
The calculating of where I want the player to go, and feeding it to world:move part, currently I have a moveable 'player' by coloring a box, and changing it's x and y coordinates, I don't know how to feed this through world:move to make it abide by bump.lua's rules, as I said earlier. That and I'm not entirely sure if I've correctly boxed off the area that I'm wanting the player to collide with and not effortlessly float through.
Ubuntu is pretty cool!
http://www.ubuntu.com
http://www.ubuntu.com
Re: Help with Collisions, bump.lua, and STI
Whatever you are doing now is calculating the x and y for the next frame already. All you need to do is put something like "player.x, player.y = world:move(player, player.x, player.y)" after your current movement code.TheScout18 wrote:The calculating of where I want the player to go, and feeding it to world:move part, currently I have a moveable 'player' by coloring a box, and changing it's x and y coordinates, I don't know how to feed this through world:move to make it abide by bump.lua's rules, as I said earlier. That and I'm not entirely sure if I've correctly boxed off the area that I'm wanting the player to collide with and not effortlessly float through.
- TheScout18
- Prole
- Posts: 10
- Joined: Tue Aug 25, 2015 2:12 am
Re: Help with Collisions, bump.lua, and STI
Got that working now! However, I'm still having problems adding the "slide" collision resolution, I added it as a filter on both the "ground" and the player, but the player will still float through the ground layer...
Ubuntu is pretty cool!
http://www.ubuntu.com
http://www.ubuntu.com
Who is online
Users browsing this forum: Bing [Bot] and 6 guests