Read the Bump documentation. Bump is the collision library. You'll need to add your player to the world, and then all movements will have to be called through bump's move function.
The bump github page gives examples on how to do all of this.
Basically, bump has a list of all collidables. When you move an object, like for example `player` with world:move(), bump will check between player's old position and player's new position to see if any collision would occur. If no collision occurs, it moves your player there, if a collision occurs, it moves your player to the collision, and then returns information about the collision.
If you just manually update player.x and player.y, bump no longer knows the current position of player, and cannot stop the player from going through collidables.
STI with Bump plugin
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
Re: STI with Bump plugin
I got it working correctly, sti wasn't adding player to the bump world, only the tileset. Is there a boolean variable for collision on specific tiles I can use? I'm working on a super mario world engine and I need to code the item boxes.
-
- Citizen
- Posts: 73
- Joined: Thu May 25, 2017 1:43 pm
Re: STI with Bump plugin
Sorry, Im new to this. Can I see the outcome? I dont quite get it.
- jojomickymack
- Prole
- Posts: 45
- Joined: Tue Dec 26, 2017 4:52 pm
Re: STI with Bump plugin
I was curious about this too - both 'bump' and 'simple tiled implementation' are fantastic libraries and they work really well together.
One huge advantage to combining these libraries is that sti anticipates that you will have a layer in your map with a boolean property called 'collidable' set to true. If that exists, collision detection on those tiles will be automatic.
One huge advantage to combining these libraries is that sti anticipates that you will have a layer in your map with a boolean property called 'collidable' set to true. If that exists, collision detection on those tiles will be automatic.
- Attachments
-
- bump_sti.love
- (76.67 KiB) Downloaded 382 times
Re: STI with Bump plugin
This is a cool feature! It wasn't obvious to me how to use it at first.DanielPower wrote: ↑Fri Mar 17, 2017 11:10 am If you need more complicated collisions, for example, using two collision boxes for a corner wall, or a smaller collision box for a thin wall, you can open the Tile Collision Editor in Tiled, and create collision boxes for an individual tile. If these collision boxes exist, STI's bump plugin will load these boxes instead of just one for the entire tile.
For this editor, you may need to name each box something specific. When I originally committed this feature, you'd have to call each box "colBox", but I believe that's since been changed to "collideable" or something similar. Check out the Bump project on Github for specifics.
In the Tiled "Tile Collision Editor", the collision box object needs to have the boolean custom property "collidable" set to true.
Also, tiles with custom collision boxes shouldn't have the "collidable" property set to true on the whole layer, they should be on a separate layer that is not "collidable". Otherwise it uses the custom collision box as well as the one of the whole tile.
-
- Prole
- Posts: 6
- Joined: Tue Sep 08, 2020 12:05 pm
Re: STI with Bump plugin
having same problem
the code
function love.load()
require 'conf';
require 'vars';
bump = require 'maps/bump';
loc= require("maps/lv1")
local sti = require "maps"
world = bump.newWorld()
test = love.audio.newSource("audio/03 Towering Chieftain.mp3","static")
map = sti(loc ,bump)
map:bump_init(world)
end
it give me that nil value also
the code
function love.load()
require 'conf';
require 'vars';
bump = require 'maps/bump';
loc= require("maps/lv1")
local sti = require "maps"
world = bump.newWorld()
test = love.audio.newSource("audio/03 Towering Chieftain.mp3","static")
map = sti(loc ,bump)
map:bump_init(world)
end
it give me that nil value also
-
- Prole
- Posts: 6
- Joined: Tue Sep 08, 2020 12:05 pm
Re: STI with Bump plugin
bump_init module isn't found in my bump.lua file can anyone send any working bump.lua not from github
-
- Prole
- Posts: 6
- Joined: Tue Sep 08, 2020 12:05 pm
Re: STI with Bump plugin
i known now and got the plugin from the STI on github but when i required it a new error came
Error
maps/bump.lua:7: loop or previous error loading module 'maps/bump'
Traceback
[C]: in function 'require'
maps/bump.lua:7: in main chunk
[C]: in function 'require'
main.lua:6: in function 'load'
[C]: in function 'xpcall'
[C]: in function 'xpcall'
the code
function love.load()
require 'conf';
require 'vars';
loc= require("maps/lv1")
require 'maps/bump'
local sti = require "maps"
test = love.audio.newSource("audio/03 Towering Chieftain.mp3","static")
map = sti(loc ,{"bump"})
world = bump.newWorld(16)
map:bump_init(world)
end
Error
maps/bump.lua:7: loop or previous error loading module 'maps/bump'
Traceback
[C]: in function 'require'
maps/bump.lua:7: in main chunk
[C]: in function 'require'
main.lua:6: in function 'load'
[C]: in function 'xpcall'
[C]: in function 'xpcall'
the code
function love.load()
require 'conf';
require 'vars';
loc= require("maps/lv1")
require 'maps/bump'
local sti = require "maps"
test = love.audio.newSource("audio/03 Towering Chieftain.mp3","static")
map = sti(loc ,{"bump"})
world = bump.newWorld(16)
map:bump_init(world)
end
-
- Prole
- Posts: 12
- Joined: Mon Sep 14, 2020 8:36 am
Re: STI with Bump plugin
Try changing line 5 to
...
require 'maps.bump'
...
...
require 'maps.bump'
...
-
- Prole
- Posts: 12
- Joined: Mon Sep 14, 2020 8:36 am
Re: STI with Bump plugin
And set a variable called bump to require bump:
local bump = require "map.bump"
local bump = require "map.bump"
Who is online
Users browsing this forum: Ahrefs [Bot], Google [Bot] and 4 guests