Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

got to like 110. How's the ai work for this? Can't understand the code above, Do u use some kind of pathfinding algorithm?

(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.