Trying to load a Tiled map with STI

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Sonic
Prole
Posts: 11
Joined: Tue Jan 02, 2018 6:25 pm
Contact:

Re: Trying to load a Tiled map with STI

Post by Sonic »

anything i have to fix or add in?
User avatar
zorg
Party member
Posts: 3465
Joined: Thu Dec 13, 2012 2:55 pm
Location: Absurdistan, Hungary
Contact:

Re: Trying to load a Tiled map with STI

Post by zorg »

Does it work currently?
Me and my stuff :3True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.
User avatar
MadByte
Party member
Posts: 533
Joined: Fri May 03, 2013 6:42 pm
Location: Braunschweig, Germany

Re: Trying to load a Tiled map with STI

Post 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.
Sonic
Prole
Posts: 11
Joined: Tue Jan 02, 2018 6:25 pm
Contact:

Re: Trying to load a Tiled map with STI

Post 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)
Attachments
game.rar
(3.86 MiB) Downloaded 76 times
User avatar
MadByte
Party member
Posts: 533
Joined: Fri May 03, 2013 6:42 pm
Location: Braunschweig, Germany

Re: Trying to load a Tiled map with STI

Post 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 :) )
Last edited by MadByte on Thu Jan 04, 2018 6:43 pm, edited 1 time in total.
Sonic
Prole
Posts: 11
Joined: Tue Jan 02, 2018 6:25 pm
Contact:

Re: Trying to load a Tiled map with STI

Post by Sonic »

Thanks for the help! I'll try my best!
Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 4 guests