I write a 2d grid-based game with grid 1x1 - when I move stay after player objects (all objects are 1x1),
how can i iterate closed area described by objects?
Many thanks for help.
It’s look that:
and I want to Instantiate objects where i marked black pencil… how can i do this?
Just create an array taking an integer variable which signifies a condition for each grid square, for example:
- player cannot walk on to
- player can walk but not walked yet
- player can walk and walked on it
And you can make more conditions than that.
Then based on the condition, change the color of the tile using instantiate and destroy old objects if you have to. If you have an array then you can easily iterate using a for each loop.