Why is my code not drawing the tiles I want where they should?
Am i not understanding smth with classes?
It's because you're reusing the same tile object and updating its properties every time through the nested loop set, so by the time you're done, you have 256 identical tiles in the table at 15,15 with the same sprite. What you probably need to do is create some kind of object instantiation function to create a new object of class tile and instantiate a new tile before setting x,y & sprite. Object-oriented Lua is not my strong suit, but the Lua manual might be of help for getting the general idea.
this will help to create separate tables!
https://www.lexaloffle.com/bbs/?tid=44686
[Please log in to post a comment]