Skip to main content

On Sale: GamesAssetsToolsTabletopComics
Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines
(1 edit)

The key code for movement is:

d=i>1and 1+((e.d-3)\2+rnd(3)\1)%4*2or e.n

That code executes when a character reaches a 8x8 tile and decides in which direction index 1+2*(0...3) it moves afterwards. Player takes i=1 and follows the next movement you selected before reaching the cell (it's a bit buggy because in order to leave a straight movement you have to set new direction just before you arrive to the tile). Ghosts take a random direction as long as it's not blocked and is different from going back. So no pathfinding, only random movement plus some logic to avoid weird behaviour.