Page 1 of 1

How to load map correctly using STI (Simple Tiled Implementation)

Posted: Thu Sep 01, 2022 8:00 pm
by RealCrayfish
I've been trying to load my map using STI however when I run Map:draw() the map is missing 2 columns on the right and 1 row on the bottom (see image). How would I go around fixing this?

Info (If somehow its useful):
Tile Size: 64x64px
Width: 32 tiles
Height: 18 tiles

Code:

Code: Select all

sti = require("libs.sti")
map = sti("assets/maps/dev.lua")

...

function love.draw()
	map:draw()
end
Edit: .love attatched just in case it somehow proves useful

Re: How to load map correctly using STI (Simple Tiled Implementation)

Posted: Thu Sep 01, 2022 11:55 pm
by pgimeno
If no one answers, maybe try in the STI thread - viewtopic.php?f=5&t=76983

Re: How to load map correctly using STI (Simple Tiled Implementation)

Posted: Fri Sep 02, 2022 2:55 pm
by Ross
I'm not sure of the exact solution, but it seems to be some interference between 'push' and STI. It's being cropped because STI thinks the viewport is smaller than it actually is. Try using map:resize(w, h) (with your game resolution) after loading the map in your game state.

Re: How to load map correctly using STI (Simple Tiled Implementation)

Posted: Fri Sep 02, 2022 3:30 pm
by RealCrayfish
Ross wrote: Fri Sep 02, 2022 2:55 pm Try using map:resize(w, h) (with your game resolution) after loading the map in your game state.
Thanks a lot! This works perfectly