Hi all, and happy new year.
I’m new to corona and lua
I’m working on a 2d Strategy game. I’ve managed to find some good working code to save and load json map files that I’ve created, and some code that will put the correct tiles on the screen, and even cull those that aren’t on the screen, and scroll the map on screen with touch.
What I need to figure out is how to make the individual tiles selectable. The don’t have to be actually selectable, but I need to know what tile was tapped by the player so I can then provide context correct options to the player, after which the changes are saved and the screen redrawn.
A small map is going to be 10 x 10 for 100 squares, and a large map will likely be around 400-500 squares.
Do I have to go at this problem differently, and make every tile an object? Intuitively, that sounds far more demanding on resources then creating some form of pointer or check procedure that can get me specific access to the tile tapped by the player.
Right now I have my maps saved as 3 dimensional array, or “table”. I’m storing y in one table, x in an another, and then TileType and TileOwner in the 3rd nesting. Actions taken by the player will effect both TileType, and TileOwner
Remember I’m new at this, so any helpful code you can provide is great, and comments explaining the tricky bits.
Thanks [import]uid: 170004 topic_id: 34457 reply_id: 334457[/import]