Page 2 of 2
Re: Trying to load a Tiled map with STI
Posted: Thu Jan 04, 2018 4:45 am
by Sonic
anything i have to fix or add in?
Re: Trying to load a Tiled map with STI
Posted: Thu Jan 04, 2018 5:53 am
by zorg
Does it work currently?
Re: Trying to load a Tiled map with STI
Posted: Thu Jan 04, 2018 8:44 am
by MadByte
Sorry, didn't answered because my computer seems to have problems with STI. It just works if I run the project in my code editor directly. Same code as zip doesn't work, but it's not a path problem because the file has been found. Seems to be a problem with STI that has to be investigated.
Your files didn't helped either. I would have needed the whole directory (excluding the sprites and sounds if they are top secret :'D) to verify that your directory structure matches with the paths in the code.
Code: Select all
-- Loading directory : ../*yourProject*/sti/ -> init.lua
local sti = require("sti")
local map
function love.load() map = sti("map.lua") end
function love.update(dt) map:update(dt) end
function love.draw() map:draw() end
This should draw the map with the newest STI version, LÖVE 0.10.2, newest Tiled, STI folder and the map.lua (saved in either base64 uncompressed or csv format i guess) in the root directory.
I would suggest to update / double check everything and then testing the code.
Re: Trying to load a Tiled map with STI
Posted: Thu Jan 04, 2018 5:01 pm
by Sonic
Here's the Winrar file. i hope this is the one (this was before i made some of the changes) (also im bad at drawing)
Re: Trying to load a Tiled map with STI
Posted: Thu Jan 04, 2018 6:29 pm
by MadByte
Sonic wrote: ↑Thu Jan 04, 2018 5:01 pm
Here's the Winrar file. i hope this is the one (this was before i made some of the changes) (also im bad at drawing)
No worries, I don't care about how your sprites look like.
Well, your code had so many problems that I don't even know where to start. I just can repeat myself:
Start by learning
the language and
LÖVE before randomly throwing code snippets together.
Problems and tips:
- You edited the library itself, don't do that. Look for library documentation (STI) to learn about how to use it. Every good library has a documentation.
- You just copy pasted some code from the STI tutorial and maybe some other sources. Try to follow the tutorial closely because without knowing what that code does, it's very likly that you won't succeed and get many errors. But before that, learn the language!
- Your saved map file wasn't exported correctly (and also not at the right path) and couldn't be opened by STI. Don't just try something and hope it works, read the documentation.. can't say that enough..
- Couple more things (like a bunch uses of "end" without an existing counterpart to it) which would be no problem at all if you'd learned some code syntax beforehand.
It wouldn't make sense to reupload your "fixed" code because it wouldn't contain more than the code snippets I already posted (apart from the music, which also wasn't loaded correctly).
I hope this doesn't sound to harsh and/or demotivating. Everyone here got similar problems when they started coding. Some found the solution on their own and others needed some post like this to unterstand that it's importent to learn (at least the basics! of)
the language!! before doing anything else. (know it's enough
)
Re: Trying to load a Tiled map with STI
Posted: Thu Jan 04, 2018 6:40 pm
by Sonic
Thanks for the help! I'll try my best!