C-Dawg
01-03-2007, 11:48 PM
To follow up the exceeingly simple enemy_ghost idea, I'll be posting enemy movement patterns as I code them. Put these codes on the invisible FFC that your custom boss FFCs are linked to.
This one makes the enemy hop around the room (ala Hardman in MM3).
// ============================================
// hop_around - This script is designed to script a hopping enemy
// in a sideview area. The FFC will target the player's location,
// then hop into the air and fall on that location.
// D0 - The speed at which the enemy moves.
// D1 - The delay before each hop.
// D2 - Drop delay (the time the enemy will take to get to the
// drop location, and wait there. If this value is too small, the
// enemy will drop before getting above the player. If it is too
// large, the enemy will hang in the air before dropping.
// D3 - The height the enemy jumps to before falling.
// D4 - The Y value of the floor of the room
// ===========================================
ffc script hop_around{
void run (int speed, int hop_delay, int drop_delay, int height, int floor_level){
int state = 0; // The state of this hopper
// 0 = resting
// 1 = hopping
int hdelay_counter = hop_delay; // Counters
int ddelay_counter = drop_delay;
int target_x; // Stores the player's x location at the start of a hop
int target_y; // Stores the player's y location at the start of a hop
while(true){
if(state == 0){
if(hdelay_counter <= 0){
state = 1;
hdelay_counter = hop_delay;
ddelay_counter = drop_delay;
target_x = Link->X;
target_y = Link->Y - height;
}
else{
hdelay_counter--;
if(this->Y > floor_level){
this->Vy = 0;
this->Vx = 0;
}
else{
this->Vy = speed;
this->Vx = 0;
}
}
} // end of state 0
if(state == 1){
if(ddelay_counter >= 0){
if(this->X < target_x){ this->Vx = speed; }
if(this->X > target_x){ this->Vx = -speed; }
if(this->Y < target_y){ this->Vy = speed; }
if(this->Y > target_y){ this->Vy = -speed; }
ddelay_counter--;
}
else{
state = 0;
}
} // end of state 1
Waitframe();
} // end of while loop
} // end of void run
} // end of ffc script
This one makes the enemy hop around the room (ala Hardman in MM3).
// ============================================
// hop_around - This script is designed to script a hopping enemy
// in a sideview area. The FFC will target the player's location,
// then hop into the air and fall on that location.
// D0 - The speed at which the enemy moves.
// D1 - The delay before each hop.
// D2 - Drop delay (the time the enemy will take to get to the
// drop location, and wait there. If this value is too small, the
// enemy will drop before getting above the player. If it is too
// large, the enemy will hang in the air before dropping.
// D3 - The height the enemy jumps to before falling.
// D4 - The Y value of the floor of the room
// ===========================================
ffc script hop_around{
void run (int speed, int hop_delay, int drop_delay, int height, int floor_level){
int state = 0; // The state of this hopper
// 0 = resting
// 1 = hopping
int hdelay_counter = hop_delay; // Counters
int ddelay_counter = drop_delay;
int target_x; // Stores the player's x location at the start of a hop
int target_y; // Stores the player's y location at the start of a hop
while(true){
if(state == 0){
if(hdelay_counter <= 0){
state = 1;
hdelay_counter = hop_delay;
ddelay_counter = drop_delay;
target_x = Link->X;
target_y = Link->Y - height;
}
else{
hdelay_counter--;
if(this->Y > floor_level){
this->Vy = 0;
this->Vx = 0;
}
else{
this->Vy = speed;
this->Vx = 0;
}
}
} // end of state 0
if(state == 1){
if(ddelay_counter >= 0){
if(this->X < target_x){ this->Vx = speed; }
if(this->X > target_x){ this->Vx = -speed; }
if(this->Y < target_y){ this->Vy = speed; }
if(this->Y > target_y){ this->Vy = -speed; }
ddelay_counter--;
}
else{
state = 0;
}
} // end of state 1
Waitframe();
} // end of while loop
} // end of void run
} // end of ffc script