Today I finished up the prototype version of my world tile system. The system works like so: an image is loaded with the pixel width and height of the world. The world dimensions are set to the image width and height, and then the pixel values are transferred into the world virtual 2D array. The renderer then interprets this data into the respective tiles. This from of loading world data (from an image) is something I learned from Notch, the creator of Minecraft, through his code.
It took awhile to get this work, as I had memory errors when trying a string-based approach. After trying to debug the code for awhile, I gave up and posted to Stack Overflow, where they found the error within minutes -.- . I suppose I have a lot to learn. Once I had got the loading working, I then did a simple hard-code of tile handling inside the rendering system. The image approach is much easier, safer, and more reliable.
Next, I think I will try to refactor the code so that it is more dynamic (currently, the tileset is hard coded into the game). Then I think I will work on collisions or animations.
No comments:
Post a Comment