Bringing enemies to life
Enemies are more than just obstacles to be avoided. Good enemies give the player a sense that there is some underlying artificial intelligence (AI). The enemies seem to know when you are near, can chase you around walls, and wander on their own. In this chapter we will create three creatures that will inhabit the world, each with their own unique AI.
Summoning the Ghost Librarian
The first creature will consist of two parts: the overdue BookPile and the Ghost Librarian that protects it. If the player approaches a BookPile, a Ghost will spawn and chase the player. If the player gets too far away from the Ghost, the Ghost will return to the BookPile that spawned it. If the player attacks the Ghost, it will disappear and respawn ...
Get HTML5 Game Development with GameMaker now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.