From the course: Unity 5: 2D Movement in an RPG Game

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Track visited tiles

Track visited tiles - Unity Tutorial

From the course: Unity 5: 2D Movement in an RPG Game

Start my 1-month free trial

Track visited tiles

- [Voiceover] Now we're ready to start calculating each of the tiles: fog of war tile ID as well as tracking whether the player has visited that tile or not. To do this we're gonna go back into our random app tester. And let's scroll down to our decorate tile method. Inside of this method, before we set the island sprite, we're gonna wanna test whether the tile has been visited or not. Let's go ahead and create a new conditioned test if tile visited is true right above if tile visited is true right above where we set the island sprite. If the tile has been visited we're gonna paint it just like we normally would. If the tile has not been visited however, we're gonna want to calculate the auto tile ID. Here we'll call tile.calculate auto tile ID. Here we'll call tile.calculate auto tile ID. This is gonna go through the current tile and all of its neighbors and calculate the new value for the fog of war auto tile ID. We recalculate this because later on when we set the flag to true, we…

Contents