Ghosts your probably thinking what is the point of this tutorial. Well wouldn't you like the certain ghosts to be blocking amimated objects, flashing lights or flickering candles ect.? This tutorial will teach you how to make the ghosts act different from one another.
Open up wl_def.h and do a search for: ghostobj
Below that add this:
ghostobj2,
ghostobj3,
ghostobj4,
Now open up wl_act2.c and do a search for void SpawnGhosts
You should see this:
void SpawnGhosts (int which, int tilex, int tiley)
{
unsigned far *map,tile;
switch(which)
{
case en_blinky:
SpawnNewObj (tilex,tiley,&s_blinkychase1);
break;
case en_clyde:
SpawnNewObj (tilex,tiley,&s_clydechase1);
break;
case en_pinky:
SpawnNewObj (tilex,tiley,&s_pinkychase1);
break;
case en_inky:
SpawnNewObj (tilex,tiley,&s_inkychase1);
break;
}
new->obclass = ghostobj;
// new->speed = SPDDOG;
new->dir = east;
new->flags |= FL_AMBUSH;
// if (!loadedgame)
// gamestate.killtotal++;
}
Modify the whole thing to this:
//Blinky
void SpawnGhosts (int which, int tilex, int tiley)
{
unsigned far *map,tile;
switch(which)
{
case en_blinky:
SpawnNewObj (tilex,tiley,&s_blinkychase1);
break;
}
new->obclass = ghostobj;
new->speed = SPDDOG;
new->dir = east;
new->flags |= FL_AMBUSH;
if (!loadedgame)
gamestate.killtotal++;
}
//Clyde
void SpawnGhosts2 (int which, int tilex, int tiley)
{
unsigned far *map,tile;
switch(which)
{
case en_clyde:
SpawnNewObj (tilex,tiley,&s_clydechase1);
break;
}
new->obclass = ghost2obj;
new->speed = SPDDOG;
new->dir = east;
new->flags |= FL_AMBUSH;
if (!loadedgame)
gamestate.killtotal++;
}
//INKY
void SpawnGhosts3 (int which, int tilex, int tiley)
{
unsigned far *map,tile;
switch(which)
{
case en_inky:
SpawnNewObj (tilex,tiley,&s_inkychase1);
break;
}
new->obclass = ghost3obj;
new->dir = east;
new->flags |= FL_AMBUSH;
}
//PINKy
void SpawnGhosts4 (int which, int tilex, int tiley)
{
unsigned far *map,tile;
switch(which)
{
case en_pinky:
SpawnNewObj (tilex,tiley,&s_pinkychase1);
break;
}
new->obclass = ghost4obj;
new->speed = 0;
new->dir = nodir;
new->flags |= FL_SHOOTABLE;
new->hitpoints = 30000;
if (!loadedgame)
gamestate.killtotal++;
}
Now each ghost has its own acting ways, one can be a blocking object when the other is a cieling light or something enjoy.