How to use bump.lua
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
Re: How to use bump.lua
I'm trouble-shooting why my player moves where there's supposed to be no rectangles. If I have a world, and my player.x and player.y, is there a smooth way to trouble-shoot exactly which rectangle he is bumping into? Of course there is a way, but how?
- kikito
- Inner party member
- Posts: 3153
- Joined: Sat Oct 03, 2009 5:22 pm
- Location: Madrid, Spain
- Contact:
Re: How to use bump.lua
All the information about the collisions, including with which rectangle each collision happened, is on the 'cols' variable, returned by world:move and world:check (third returned value).Bindie wrote:I'm trouble-shooting why my player moves where there's supposed to be no rectangles. If I have a world, and my player.x and player.y, is there a smooth way to trouble-shoot exactly which rectangle he is bumping into? Of course there is a way, but how?
Code: Select all
local actualX, actualY, cols, len = world:move(...)
When I write def I mean function.
Re: How to use bump.lua
Cool. It seems when I try to teleport my player to tele_x and tele_y, because it's walls in the way bump.lua somehow thinks there is walls in the way to teleport the player. The room is in the middle of a big base with lots of colliding tiles around (walls), so there is walls in the way.
Can I bypass this collision checking somehow so I can teleport my player without bumping into colliding tiles?
Basically this is my code:
Can I bypass this collision checking somehow so I can teleport my player without bumping into colliding tiles?
Basically this is my code:
Code: Select all
if love.keyboard.isDown(" ") then
player.x = tele_x
player.y = tele_y
end
-- Player collision check
if player.Current_station ~= nil then
for i,v in ipairs(Universe) do
if v.x == player.Current_Station.x and v.y == player.Current_Station.y then
local newX, newY, cols, len = v.world:move(player, player.x, player.y)
player.x, player.y = newX, newY
print(newX, newY, cols, len)
end
end
end
end
Re: How to use bump.lua
Yeah, you can use world:update().
Code: Select all
-- teleport the player without collision
world:update(player, player.x, player.y)
Re: How to use bump.lua
Thank you very much.
Re: How to use bump.lua
Bump.lua, love it!
Re: How to use bump.lua
Hey, in my little bomberman clone the players are the same tilesize as the map. When I move into a free space, the space is narrow. Is there some precision raising way when trying to get into a "L-free space":
Right now the player misses when trying to turn into the little space.
Code: Select all
x.p.x
x.|.x
x.|.x
x.-->
xxxx
-- p = player with medium speed trying to get into a L-"free space".
- kikito
- Inner party member
- Posts: 3153
- Joined: Sat Oct 03, 2009 5:22 pm
- Location: Madrid, Spain
- Contact:
Re: How to use bump.lua
The immediate solution I can think of is make your player slightly smaller: instead of making him 32x32, try 31.99x31.99. The difference should not be noticeable, but it should fix the issue.
Other than that, please upload a .love displaying the problem, so I can give it a look.
Other than that, please upload a .love displaying the problem, so I can give it a look.
When I write def I mean function.
Re: How to use bump.lua
Sure, it's when you press right key first, then try to move up and down.
Easter egg: Turn the file name inverted horizontal.
Easter egg: Turn the file name inverted horizontal.
- Attachments
-
- powp6Lw9u.love
- (182.15 KiB) Downloaded 208 times
- kikito
- Inner party member
- Posts: 3153
- Joined: Sat Oct 03, 2009 5:22 pm
- Location: Madrid, Spain
- Contact:
Re: How to use bump.lua
I managed to get to the left between to columns (attaching screenshot)
Your problem is not bump-specific. You would have had it with any other collision library, even one made by yourself.
The problem here is that your players are so big, they have to be exactly at the right coordinate, or they can't enter a corridor. Imagine that a corridor must be entered at y=164. If the players are at y=163.99, they will not fit through the corridor (their "top" will "hit the corridor wall"). Similarly, if the player is at y=164.01, their bottom will hit the bottom wall.
The other thing is that getting exactly to 164 using a dt-based movement is almost impossible. Try printing out the coords of the player to see what I mean. With dt alone, you almost always have decimals.
There are two ways to solve this: either you make your characters smaller (at least 2/3 of a tile), or you make the movement help the player. There are lots of ways to do this. You could, for example, only allow integer coordinates in your players (so they can be in 163 or 164, but never in 163.819283). You can also try a combination of both.
Your problem is not bump-specific. You would have had it with any other collision library, even one made by yourself.
The problem here is that your players are so big, they have to be exactly at the right coordinate, or they can't enter a corridor. Imagine that a corridor must be entered at y=164. If the players are at y=163.99, they will not fit through the corridor (their "top" will "hit the corridor wall"). Similarly, if the player is at y=164.01, their bottom will hit the bottom wall.
The other thing is that getting exactly to 164 using a dt-based movement is almost impossible. Try printing out the coords of the player to see what I mean. With dt alone, you almost always have decimals.
There are two ways to solve this: either you make your characters smaller (at least 2/3 of a tile), or you make the movement help the player. There are lots of ways to do this. You could, for example, only allow integer coordinates in your players (so they can be in 163 or 164, but never in 163.819283). You can also try a combination of both.
When I write def I mean function.
Who is online
Users browsing this forum: Bing [Bot], Google [Bot] and 5 guests