Last month I had implemented dungeon generation for my first-person roguelike/RPG game, but it wasn’t populated yet, nor could you move around it. Well, I’ve since programmed that stuff.
Movement of the player was pretty much just copy-pasting the relevant code from my long dormant dungeon crawler. Mostly this was about manipulating the player’s transform with commands from my tweening library of choice, DOTween.
Movement for the enemies was slightly trickier to implement, but only because there wasn’t a pre-existing system I could repurpose in this project. I simply used the A* pathfinding library I talked about last post, and then only have the enemy take the first step on the found path.
Incidentally, note that the turn only advances when the player moves to a new grid space, not while rotating in place. I guess this is something to watch during playtesting, but it seems better to allow the player to freely look around.
One thought on “Grid-based movement for both Player and Enemies”