Code Editing Tutorials
Changing all Pacmans to 1 shootable enemy!

Step 1. Open up WL_DEF.H and do a search for s_grddie. You should find it around line 1184. Now, below "s_grddie", you add this line:

extern statetype s_ghostdie;


Step 2. Open up WL_ACT2.C and go to line 451. There you will find:


extern statetype s_blinkychase1;

extern statetype s_blinkychase2;

extern statetype s_inkychase1;

extern statetype s_inkychase2;

extern statetype s_pinkychase1;

extern statetype s_pinkychase2;

extern statetype s_clydechase1;

extern statetype s_clydechase2;

statetype s_blinkychase1 = {false,SPR_BLINKY_W1,10,T_Ghosts,NULL,&s_blinkychase2};

statetype s_blinkychase2 = {false,SPR_BLINKY_W2,10,T_Ghosts,NULL,&s_blinkychase1};

statetype s_inkychase1 = {false,SPR_INKY_W1,10,T_Ghosts,NULL,&s_inkychase2};

statetype s_inkychase2 = {false,SPR_INKY_W2,10,T_Ghosts,NULL,&s_inkychase1};

statetype s_pinkychase1 = {false,SPR_PINKY_W1,10,T_Ghosts,NULL,&s_pinkychase2};

statetype s_pinkychase2 = {false,SPR_PINKY_W2,10,T_Ghosts,NULL,&s_pinkychase1};

statetype s_clydechase1 = {false,SPR_CLYDE_W1,10,T_Ghosts,NULL,&s_clydechase2};

statetype s_clydechase2 = {false,SPR_CLYDE_W2,10,T_Ghosts,NULL,&s_clydechase1};


Step 3. Change them like this:


extern statetype s_blinkychase1;

extern statetype s_blinkychase2;

extern statetype s_blinkyshoot1;

extern statetype s_blinkyshoot2;

extern statetype s_blinkydie1;

extern statetype s_blinkydie2;

extern statetype s_blinkydie3;

extern statetype s_blinkydie4;

statetype s_blinkychase1 = {false,SPR_BLINKY_W1,10,T_Chase,NULL,&s_blinkychase2};

statetype s_blinkychase2 = {false,SPR_BLINKY_W2,10,T_Chase,NULL,&s_blinkychase1};

statetype s_blinkydie1 = {false,SPR_INKY_W1,10,NULL,A_DeathScream,&s_inkychase2};

statetype s_blinkydie2 = {false,SPR_INKY_W2,10,NULL,NULL,&s_inkychase1};

statetype s_blinkydie3 = {false,SPR_PINKY_W1,10,NULL,NULL,&s_pinkychase2};

statetype s_blinkydie4 = {false,SPR_PINKY_W2,10,NULL,NULL,&s_pinkychase1};

statetype s_blinkyshoot1 = {false,SPR_CLYDE_W1,10,NULL,NULL,&s_clydechase2};

statetype s_blinkyshoot2 = {false,SPR_CLYDE_W2,10,T_Shoot,NULL,&s_clydechase1};


Step 4. Now do a search for "spawnghosts" and change it like this:


void SpawnGhosts (int which, int tilex, int tiley)

{

unsigned far *map,tile;

SpawnNewObj (tilex,tiley,&s_blinkychase1);

new->speed = SPDPATROL;

new->obclass = ghostobj;

new->hitpoints = starthitpoints[gamestate.difficulty][en_blinky];

new->dir = south;

new->flags |= FL_SHOOTABLE|FL_AMBUSH;

if (!loadgame)

gamestate.killtotal++;

}


step 5. Open up WL_STATE.C and do a search for "case bossobj". Now add these lines above it:


case ghostobj:

GivePoints (500);

NewState (ob,&s_blinkydie1);

break;

Step 6. Do another search for "case bossobj". Now add these lines above it:


case ghostobj:

SD_PlaySound(YOURSOUND); // Change this to your liking

NewState (ob,&s_blinkychase1);

ob->speed = SPDPATROL*4;

break;

Step 7. Do another search for "case bossobj". Now add this line above it:


case ghostobj:


Step 8. Save and compile the files. Now you have, instead of 4 different ghosts, one ghost which can be killed.

NOTE: Change your levels and OBJDATA files accordingly!



 

Get back to the Dome tutorials
Jump to the top