Thank You for kind words
I need to learn this stuff and then sort things out to find best approach. I used array (as array of xxx) for the first time 2 days ago
. I'm also going to read Your tutorial.
I think I know what to do know (thanks to Your suggestions) but I need to acctually make project to test it (oh. man I'm loving this
)
* declare array for world (World)
* generate random terrain (Land/Water)
* store information about generated terrain - thats coords of blocks (for now it will be only land as soil/grass whatever, maybe with random variant of image, and empty=sea)
* declare array for WorldObjects //like factories etc. Same dimensions as World array
* get info where player had clicked on map and transfer/translate this info to hm.. this will be complicated
- If player is in building mode (i.e. placing factory/budynek) then World array will be checked but WorldObjects also needs to be checked if place is free (no building is there)
- If player is in destruction mode (i.e. destroying factory) then WorldObjects array will be checked
- If player is in normal mode (i.e. upgrading factory or sth) then WorldObjects array will be checked
Or maybe I could use one array to store terrain and update it while game is in progress.
- IF tile is land THEN check
IF its occupied (two states of World array element.. Good to be occupied and occupied by sth (this will need to be few other states e.g. 'Occupied by Shoe Factory', 'Occupied by Donut Factory' etc.) THEN show message that selected building can't be placed
IF place is NOT occupied THEN place selected building and change state of World array
Save World array and render it on canvas.
I could also add option for player mode here.. that would be another IF statement (Player mode=[pmBuilding,pmDestroying, pmUpgrading etc] Hm
Not sure what would work but I'll try
And ofcourse game will be free as I'm doing it just for fun and to learn programming