Simple Tiled Implementation - STI v1.2.3.0
Re: Simple Tiled Implementation - STI v0.9.3
I've updated STI to return "false" instead of "nil" for tile positions where there is no tile, so that should at least fix some issues.
In your particular case, I also needed to add a check for the mouse that it was within bounds of the map. Check the attached file, it has the updated STI and it works well.
In your particular case, I also needed to add a check for the mouse that it was within bounds of the map. Check the attached file, it has the updated STI and it works well.
- Attachments
-
- test-sti.love
- (20.09 KiB) Downloaded 181 times
STI - An awesome Tiled library
LÖVE3D - A 3D library for LÖVE 0.10+
Dev Blog | GitHub | excessive ❤ moé
LÖVE3D - A 3D library for LÖVE 0.10+
Dev Blog | GitHub | excessive ❤ moé
Re: Simple Tiled Implementation - STI v0.9.2
I submitted a real fix to this issue.ds84182 wrote:No, I managed to fix the problem though. framework.clear is called but it doesn't clear the actual canvas, instead it was clearing the screen.
STI - An awesome Tiled library
LÖVE3D - A 3D library for LÖVE 0.10+
Dev Blog | GitHub | excessive ❤ moé
LÖVE3D - A 3D library for LÖVE 0.10+
Dev Blog | GitHub | excessive ❤ moé
Re: Simple Tiled Implementation - STI v0.9.4
I only read over the last few posts on the topic, so if this is addressed somewhere, I do apologize.
I have had a couple of problems with the codebase, which I have worked around, but would like some clarification on.
First:
You mentioned that you set empty tiles to false in the newest version. The older version works correctly for me but this new change leaves me with:
to:
gets it running again. Can you help me understand this?
Secondly, on line approx. 300 in the collidable layer property of the calculateObjectPosition(object, tile) method of the Map:initWorldCollision(world) function, changing:
to:
fixes a huge gap (200 pixels for a 24x24 tile) between collision objects.
Anyway, this is mostly academic. Thank you so much for your library, it has helped me tremendously, and it was easy enough to add userdata to the tiles for collision callbacks, etc, although I am just figuring all this out. : )
I have had a couple of problems with the codebase, which I have worked around, but would like some clarification on.
First:
You mentioned that you set empty tiles to false in the newest version. The older version works correctly for me but this new change leaves me with:
Changing line 524 (approx.) in map.lua from:"map.lua : line 296 - attempt to index local 'tile' (a boolean value)"
Code: Select all
map[y][x] = false
Code: Select all
map[y][x] = nil
Secondly, on line approx. 300 in the collidable layer property of the calculateObjectPosition(object, tile) method of the Map:initWorldCollision(world) function, changing:
Code: Select all
x = x * self.width + tile.offset.x,
y = y * self.height + tile.offset.y,
Code: Select all
x = x * tile.width + tile.offset.x,
y = y * tile.height + tile.offset.y,
Anyway, this is mostly academic. Thank you so much for your library, it has helped me tremendously, and it was easy enough to add userdata to the tiles for collision callbacks, etc, although I am just figuring all this out. : )
Re: Simple Tiled Implementation - STI v0.9.4
Hey, I'm trying to learn how to use STI and so I tried compiling with the initWorldCollision example and it gives an error.
I tried exporting from Tiled 10.2 initially and then Tiled 10.1. It is a single-layer 100x100 map, tiles 16x16, with certain tiles having the property collidable=true I'm using the latest version.
Here is the code I'm using to compile
And here is the error:
I tried exporting from Tiled 10.2 initially and then Tiled 10.1. It is a single-layer 100x100 map, tiles 16x16, with certain tiles having the property collidable=true I'm using the latest version.
Here is the code I'm using to compile
Code: Select all
local sti = require "sti"
function love.load()
-- Grab window size
windowWidth = love.graphics.getWidth()
windowHeight = love.graphics.getHeight()
-- Set world meter size (in pixels)
love.physics.setMeter(16)
-- Load a map exported to Lua from Tiled
map = sti.new("assets/maps/map1")
-- Prepare physics world (horizontal and vertical gravity)
world = love.physics.newWorld(0, 0)
-- Prepare collision objects
collision = map:initWorldCollision(world)
end
Code: Select all
Error: sti/map.lua:270: bad argument #1 to 'ipairs' (table expected, got nil)
stack traceback:
[C]: in function 'ipairs'
sti/map.lua:270: in function 'initWorldCollision'
main.lua:19: in function 'load'
[string "boot.lua"]:407: in function <[string "boot.lua"]:399>
[C]: in function 'xpcall'
Re: Simple Tiled Implementation - STI v0.9.4
Hey guys, in regards to the problem above, changing line 269 from
to
fixes this. Turns out, the reason it's nil is simply because if there a tile with the property "collidable=true" that is not placed on the map, then self.tileInstances[gid] will be nil for that tile.
Code: Select all
elseif tile.properties.collidable == "true" then
Code: Select all
elseif tile.properties.collidable == "true" and self.tileInstances[gid]~=nil then
Re: Simple Tiled Implementation - STI v0.9.4
Cool, I'll be sure to fix this soon!
STI - An awesome Tiled library
LÖVE3D - A 3D library for LÖVE 0.10+
Dev Blog | GitHub | excessive ❤ moé
LÖVE3D - A 3D library for LÖVE 0.10+
Dev Blog | GitHub | excessive ❤ moé
- CrackedP0t
- Citizen
- Posts: 69
- Joined: Wed May 07, 2014 4:01 am
- Contact:
Re: Simple Tiled Implementation - STI v0.9.4
Two questions: How would I draw the map to the entire screen regardless of its resolution, and how easy would implementing bump.lua alongside STI be?
/人 ◕‿‿◕ 人\
Here, have an umlaut. Ö
Here, have an umlaut. Ö
Re: Simple Tiled Implementation - STI v0.9.4
Do you mean to scale the map up or down to fit the screen, or just draw everything, ignoring culling?
I have not used bump.lua, give it a go and report back.
I have not used bump.lua, give it a go and report back.
STI - An awesome Tiled library
LÖVE3D - A 3D library for LÖVE 0.10+
Dev Blog | GitHub | excessive ❤ moé
LÖVE3D - A 3D library for LÖVE 0.10+
Dev Blog | GitHub | excessive ❤ moé
- CrackedP0t
- Citizen
- Posts: 69
- Joined: Wed May 07, 2014 4:01 am
- Contact:
Re: Simple Tiled Implementation - STI v0.9.4
Scaling it to fit the screen
bump.lua integration shouldn't be too hard
bump.lua integration shouldn't be too hard
/人 ◕‿‿◕ 人\
Here, have an umlaut. Ö
Here, have an umlaut. Ö
Re: Simple Tiled Implementation - STI v0.9.4
Local scale = window_height / (map.height * map.tileheight)
STI - An awesome Tiled library
LÖVE3D - A 3D library for LÖVE 0.10+
Dev Blog | GitHub | excessive ❤ moé
LÖVE3D - A 3D library for LÖVE 0.10+
Dev Blog | GitHub | excessive ❤ moé
Who is online
Users browsing this forum: Ahrefs [Bot], Bing [Bot] and 3 guests