I am having a hard time understanding how to use the Bump plugin with Simple Tiled Implementation. The documentation is lacking.
I looked through the code of plugins/bump.lua and it seems to check for a custom property of tiles or objects called "collidable". if that is true, how do I interact with it? One of the other plugins is box2d. Is that another collision library I could use and which one would be best? Thanks!
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.
- Sir_Silver
- Party member
- Posts: 286
- Joined: Mon Aug 22, 2016 2:25 pm
- Contact:
Re: STI with Bump plugin
In Tiled, you can set a custom property, specifically a bool, for either a tile or an entire layer called "collidable". If it is set to true, it will be added to the bump world, and will have "normal" collisions set up for you. I recommend using bump plugin because it's the only one I'm familiar with at all. =)
- DanielPower
- Citizen
- Posts: 50
- Joined: Wed Apr 29, 2015 5:28 pm
Re: STI with Bump plugin
If you want to make a specific tile collidable, click the tile in your tileset pane, and then under the properties pane on the left, click the + icon, and create a new boolean property called collideable. Set this to true.
Once you've added collidable tiles in your tiled map, you need to load them in your game.
That's it! Your world should no contain collidables for each of the collidable tiles in your Tiled map.
Once you've added collidable tiles in your tiled map, you need to load them in your game.
Code: Select all
local world = bump.newWorld()
local map = sti('mapfile.lua', {"bump"}) -- This loads the map file, and loads the bump plugin for STI
map:bump_init(world) -- This initializes the bump plugin, and loads all of your collidable tiles
- DanielPower
- Citizen
- Posts: 50
- Joined: Wed Apr 29, 2015 5:28 pm
Re: STI with Bump plugin
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.
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.
Re: STI with Bump plugin
Thank yall very much. Is this all that is needed to interact with player.x and player.y?
Re: STI with Bump plugin
I tried the code above and it doesn't work. when I do the first line I get "global bump (a nil value)", like the plugin isn't being loaded. I'm even trying to call it after setting the map variable. I'm getting error after error trying to fix the code. I don't know what to do to get it to work.DanielPower wrote: ↑Fri Mar 17, 2017 11:05 am If you want to make a specific tile collidable, click the tile in your tileset pane, and then under the properties pane on the left, click the + icon, and create a new boolean property called collideable. Set this to true.
Once you've added collidable tiles in your tiled map, you need to load them in your game.
That's it! Your world should no contain collidables for each of the collidable tiles in your Tiled map.Code: Select all
local world = bump.newWorld() local map = sti('mapfile.lua', {"bump"}) -- This loads the map file, and loads the bump plugin for STI map:bump_init(world) -- This initializes the bump plugin, and loads all of your collidable tiles
- DanielPower
- Citizen
- Posts: 50
- Joined: Wed Apr 29, 2015 5:28 pm
Re: STI with Bump plugin
Well, do you have the bump library loaded? You'll need to get bump.lua, put it into your game's directory, and load it into your game using
You can't use STI's bump plugin unless you have bump loaded.
Code: Select all
local bump = require('bump')
Re: STI with Bump plugin
So I need to know what kind of data should go in "bump_init(map, world)". I'm assuming map should be the map file that sti is loading, but I don't know what world is, especially since there isn't a bump.newWorld() function present. This is where it is giving me an error, Attempt to call method 'add' (a nil value) on this line in bump.luaDanielPower wrote: ↑Fri Mar 17, 2017 11:05 am If you want to make a specific tile collidable, click the tile in your tileset pane, and then under the properties pane on the left, click the + icon, and create a new boolean property called collideable. Set this to true.
Once you've added collidable tiles in your tiled map, you need to load them in your game.
That's it! Your world should no contain collidables for each of the collidable tiles in your Tiled map.Code: Select all
local world = bump.newWorld() local map = sti('mapfile.lua', {"bump"}) -- This loads the map file, and loads the bump plugin for STI map:bump_init(world) -- This initializes the bump plugin, and loads all of your collidable tiles
line 58
Code: Select all
world:add(t, t.x, t.y, t.width, t.height)
Re: STI with Bump plugin
lol i thought the bump plugin was the full library. thanks ill try thatDanielPower wrote: ↑Fri Mar 17, 2017 4:27 pm Well, do you have the bump library loaded? You'll need to get bump.lua, put it into your game's directory, and load it into your game usingYou can't use STI's bump plugin unless you have bump loaded.Code: Select all
local bump = require('bump')
Re: STI with Bump plugin
I got it working with the bump tiles being drawn with map:bump_draw(world) but I'm not sure how to make player.x and player.y interact with itDanielPower wrote: ↑Fri Mar 17, 2017 11:05 am If you want to make a specific tile collidable, click the tile in your tileset pane, and then under the properties pane on the left, click the + icon, and create a new boolean property called collideable. Set this to true.
Once you've added collidable tiles in your tiled map, you need to load them in your game.
That's it! Your world should no contain collidables for each of the collidable tiles in your Tiled map.Code: Select all
local world = bump.newWorld() local map = sti('mapfile.lua', {"bump"}) -- This loads the map file, and loads the bump plugin for STI map:bump_init(world) -- This initializes the bump plugin, and loads all of your collidable tiles
Who is online
Users browsing this forum: Bing [Bot] and 7 guests