Gleeok
11-17-2007, 09:28 AM
These are pretty well explained in the footnotes so read them first and i'll be happy to answer any questions if you need help past that point.
And without further ado, I give you more scripts. Yay!
First item up for bid is the enemy_spawner mark III:
//================================================== =====
// ENEMY SPAWNER 3- Will spawn a preset amount of enemies
// from a pool of 3, chosen at random.
// Will place enemies at random locations if walkable.
// D0-D2; Enemies that might spawn,
// D3; Delay in ticks between spawns
// D4; Max number of enemies that will spawn.
// Thanks C-Dawg!
//================================================== =====
ffc script enemyspawner3 {
void run(int e1, int e2, int e3, int delay, int enemy_count ) {
int RandNum = Rand(3);
int en_count = enemy_count;
int counter = delay;
while(en_count > 0){
if ( counter == 0 && RandNum == 0){
putenemy(e1);
counter = delay;
RandNum = Rand(3);
en_count = en_count - 1;
}if ( counter == 0 && RandNum == 1){
putenemy(e2);
counter = delay;
RandNum = Rand(3);
en_count = en_count - 1;
}if ( counter == 0 && RandNum == 2){
putenemy(e3);
counter = delay;
RandNum = Rand(3);
en_count = en_count - 1;
}
counter--;
Waitframe();
} // end of while loop
}
void putenemy(int eid){
int x = Rand(12)+2;
int y = Rand(7)+2;
while(!is_walkable(x,y))
{
x = Rand(12)+2;
y = Rand(7)+2;
}
npc en = Screen->CreateNPC(eid);
if(en->isValid())
{
en->X = x*16;
en->Y = y*16;
}
}
bool is_walkable(int x, int y)
{
return Screen->ComboS[x+y*16]==0;
}
}
This ones sure to be popular with the ladies.
Our next item is the Sentry script. aka; the veg-o-matic! If you use this and still don't know why I call it the veg-o-matic, well, then I know something you don't know. :p
// FFC SCRIPT VEG-O-MATIC---------------------------------------
//D0- vertical guard set 1
//D1- horizontal guard set 1 *NOT BOTH!!!*
//D2- set 1 if can fire weapons
//D3- combo of weapon if d2
//D4- speed of weapon projectile if d2
//D5- time in tics between shots
//D6- CSet of weapon projectile
//D7- the starting ffc to use for projectiles
//---------------------------------------------------------
ffc script Veg_O_Matic{
void run(int vert, int horiz, int armed, int weapon_combo, int speed, int rapid, int cset, int ffc_to_use){
ffc shoot;
int ffc_cycle = ffc_to_use;
int delay = 0;
while(true){
delay++;
if(ffc_cycle >= ffc_to_use+4){ ffc_cycle = ffc_to_use;}
if(vert == 1){ if(this->Y > Link->Y+2){ this->Y--;} if(this->Y < Link->Y-2){ this->Y++;}}
if(horiz == 1){ if(this->X > Link->X+2){ this->X--;} if(this->X < Link->X-2){ this->X++;}}
if(armed == 1){
if(vert == 1){
if(delay == rapid && Link->X > this->X){
shoot = Screen->LoadFFC(ffc_cycle);
shoot->Data = weapon_combo;
shoot->Y = this->Y; shoot->X = this->X + 16;
shoot->Vx = speed;
shoot->CSet = cset;
ffc_cycle++;
delay = 0;
}
if(delay == rapid && Link->X < this->X){
shoot = Screen->LoadFFC(ffc_cycle);
shoot->Data = weapon_combo;
shoot->Y = this->Y; shoot->X = this->X - 16;
shoot->Vx = -speed;
shoot->CSet = cset;
ffc_cycle++;
delay = 0;
}
}
if(horiz == 1){
if(delay == rapid && Link->Y > this->Y){
shoot = Screen->LoadFFC(ffc_cycle);
shoot->Data = weapon_combo;
shoot->Y = this->Y + 16; shoot->X = this->X;
shoot->Vy = speed;
shoot->CSet = cset;
ffc_cycle++;
delay = 0;
}
if(delay == rapid && Link->Y < this->Y){
shoot = Screen->LoadFFC(ffc_cycle);
shoot->Data = weapon_combo;
shoot->Y = this->Y - 16; shoot->X = this->X;
shoot->Vy = -speed;
shoot->CSet = cset;
ffc_cycle++;
delay = 0;
}
}
}
Waitframe();
}
}
}
Ok, Ok, I know what you're thinking right now: "How can I get 255(or is that 256?) enemies on the screen at once and center them on an enemy and set that enemies HP to any obscene amount I want"? Well alrighty then, ask and ye shall recieve.
Flamethrower script:
//=======================================
// FFC SCRIPT FLAMETHROWER
//D0- minions to spawn (id number)
//D1- HP of the summoner
//D2- Max enemies on screen at once
//=======================================
ffc script Flamethrower{
void run(int enemy_id, int enemyHP, int enemy_swarm){
int enemy_number = 0;
npc enemy;
int slow_slowdown=0;
int death = 0;
Waitframes(4);
npc fire_master = Screen->LoadNPC(1);
npc firestorm;
fire_master->HP = enemyHP;
while(true){
if(fire_master->isValid() || fire_master->HP >0){
this->X = fire_master->X; this->Y = fire_master->Y;
if(Screen->NumNPCs() < enemy_swarm){ npc firestorm = Screen->CreateNPC(enemy_id);}
firestorm->X = this->X;
firestorm->Y = this->Y;
}
else{ death = 1;}
enemy_number = Screen->NumNPCs();
while(enemy_number > 1){
enemy = Screen->LoadNPC(enemy_number);
enemy->X = this->X; enemy->Y = this->Y;
if(death == 1){enemy->HP = 0;Screen->ClearSprites(2);}
enemy_number--;
if(enemy_number > 30){
if(slow_slowdown == 0){ slow_slowdown = enemy_number; Waitframe();}
slow_slowdown--;
}
}
Waitframe();
}
}
}
And now to make sure Link walks around in circles while being forced to repeadedly battle these baddies:
Random door generator:
//------------------------------------------------------
// Creates 1-3 closed shutters in a random direction as
// long as there is a wall.-along with a one-way wherever link enters from.
// Once the enemies have been killed the shutter will open.
// This will not overwrite essential doors added for specific dungeon map layouts :)
// For best results run at *SCREEN INIT*
// Not used yet/ -random locked doors, boss doors, open doors-
//------------------------------------------------------
ffc script random_door_generator{ //ver2.1
void run(){
int ddoor = 0;
int udoor = 0;
int ldoor = 0;
int rdoor = 0;
int RandNum = Rand(4);
if (Link->Dir == 0 && Screen->Door[DIR_DOWN] == D_WALL){ ddoor = 1;}
if (Link->Dir == 1 && Screen->Door[DIR_UP] == D_WALL){ udoor = 1;}
if (Link->Dir == 2 && Screen->Door[DIR_RIGHT] == D_WALL){ rdoor = 1;}
if (Link->Dir == 3 && Screen->Door[DIR_LEFT] == D_WALL){ ldoor = 1;}
if (RandNum == 0 && Screen->Door[DIR_DOWN] == D_WALL){ Screen->Door[DIR_DOWN] = D_SHUTTER;}
if (RandNum == 0 && Screen->Door[DIR_UP] == D_WALL){Screen->Door[DIR_UP] = D_SHUTTER;}
if (RandNum == 1 && Screen->Door[DIR_RIGHT] == D_WALL){Screen->Door[DIR_RIGHT] = D_SHUTTER;}
if (RandNum == 1 && Screen->Door[DIR_LEFT] == D_WALL){Screen->Door[DIR_LEFT] = D_SHUTTER; }
if (RandNum == 2 && Screen->Door[DIR_DOWN] == D_WALL){Screen->Door[DIR_DOWN] = D_SHUTTER;}
if (RandNum == 2 && Screen->Door[DIR_UP] == D_WALL){Screen->Door[DIR_UP] = D_SHUTTER;}
if (RandNum == 2 && Screen->Door[DIR_RIGHT] == D_WALL){Screen->Door[DIR_RIGHT] = D_SHUTTER;}
if (RandNum == 3 && Screen->Door[DIR_LEFT] == D_WALL){Screen->Door[DIR_LEFT] = D_SHUTTER;}
if (RandNum == 3 && Screen->Door[DIR_RIGHT] == D_WALL){Screen->Door[DIR_RIGHT] = D_SHUTTER;}
if (RandNum == 3 && Screen->Door[DIR_UP] == D_WALL){Screen->Door[DIR_UP] = D_SHUTTER; }
if (ddoor == 1){Screen->Door[DIR_DOWN] = D_1WAYSHUTTER;}
if (udoor == 1){Screen->Door[DIR_UP] = D_1WAYSHUTTER;}
if (rdoor == 1){Screen->Door[DIR_RIGHT] = D_1WAYSHUTTER;}
if (ldoor == 1){Screen->Door[DIR_LEFT] = D_1WAYSHUTTER; }
}
}
2.6 Armos script:
//======================================
// -ffc script Armos-
//D0 - id of enemy to create
//D1 - HP of created enemy
//======================================
ffc script Armos{
void run(int enemy_id, int enemyHP){
int trigger = 0;
npc armos;
while(true){
if(trigger == 0){
if( Abs(Link->X - this->X) <= 16 && Abs(Link->Y - this->Y) <= 16){
npc armos = Screen->CreateNPC(enemy_id);
armos->X = this->X; armos->Y = this->Y;
armos->HP = enemyHP;
this->Data=0;trigger=1;
}
}
Waitframe();
}
}
}
New one, Custom Armos. This one will get used...alot. I'm sure of it. ;)
I guess it's true with scripts anyway; It's not how big it is, it's how you use it. :laughing:
//================================================== ================================
// FFC SCRIPT SENTRY
//
// D0 - Direction can shoot / values greater than 3 return up,down,left,right.
// D1 - combo of weapon projectile
// D2 - speed of projectile
// D3 - CSet of projectile
// D4 - First of 3 ffc's to use as projectiles
//================================================== ================================
ffc script Sentry{
void run(int shoot_dir, int weapon_combo, int speed, int cset, int ffc_to_use){
ffc shoot;
int ffc_cycle = ffc_to_use;
int delay = 0;
while(true){
if(ffc_cycle >= ffc_to_use+3){ ffc_cycle = ffc_to_use;}
if(delay > 0){delay--;}
if(shoot_dir > 3 && delay == 0){
if(Abs(Link->X-this->X)<14 && Link->Y < this->Y && canMove(this->X, this->Y-16)) // Up
{
shoot = Screen->LoadFFC(ffc_cycle);
shoot->Data = weapon_combo;
shoot->Y = this->Y - 16; shoot->X = this->X;
shoot->Vy = -speed; shoot->Vx=0;
shoot->CSet = cset;
ffc_cycle++;
delay = 30;
}
else if(Abs(Link->X-this->X)<14 && Link->Y > this->Y && canMove(this->X, this->Y+16)) // Down
{
shoot = Screen->LoadFFC(ffc_cycle);
shoot->Data = weapon_combo;
shoot->Y = this->Y + 16; shoot->X = this->X;
shoot->Vy = speed; shoot->Vx=0;
shoot->CSet = cset;
ffc_cycle++;
delay = 30;
}
else if(Abs(Link->Y-this->Y)<14 && Link->X < this->X && canMove(this->X-16, this->Y)) // Left
{
shoot = Screen->LoadFFC(ffc_cycle);
shoot->Data = weapon_combo;
shoot->Y = this->Y; shoot->X = this->X - 16;
shoot->Vx = -speed; shoot->Vy=0;
shoot->CSet = cset;
ffc_cycle++;
delay = 30;
}
else if(Abs(Link->Y-this->Y)<14 && Link->X > this->X && canMove(this->X+16, this->Y)) // Right
{
shoot = Screen->LoadFFC(ffc_cycle);
shoot->Data = weapon_combo;
shoot->Y = this->Y; shoot->X = this->X + 16;
shoot->Vx = speed; shoot->Vy=0;
shoot->CSet = cset;
ffc_cycle++;
delay = 30;
}
}
else{
if(shoot_dir==0 && delay == 0){
if(Abs(Link->X-this->X)<14 && Link->Y < this->Y && canMove(this->X, this->Y-16)){
shoot = Screen->LoadFFC(ffc_cycle);
shoot->Data = weapon_combo;
shoot->Y = this->Y - 16; shoot->X = this->X;
shoot->Vy = -speed; shoot->Vx=0;
shoot->CSet = cset;
ffc_cycle++;
delay = 30;
}
}
else if(shoot_dir==1 && delay == 0){
if(Abs(Link->X-this->X)<14 && Link->Y > this->Y && canMove(this->X, this->Y+16)){
shoot = Screen->LoadFFC(ffc_cycle);
shoot->Data = weapon_combo;
shoot->Y = this->Y + 16; shoot->X = this->X;
shoot->Vy = speed; shoot->Vx=0;
shoot->CSet = cset;
ffc_cycle++;
delay = 30;
}
}
else if(shoot_dir==2 && delay == 0){
if(Abs(Link->Y-this->Y)<14 && Link->X < this->X && canMove(this->X-16, this->Y)){
shoot = Screen->LoadFFC(ffc_cycle);
shoot->Data = weapon_combo;
shoot->Y = this->Y; shoot->X = this->X - 16;
shoot->Vx = -speed; shoot->Vy=0;
shoot->CSet = cset;
ffc_cycle++;
delay = 30;
}
}
else if(shoot_dir==3 && delay == 0){
if(Abs(Link->Y-this->Y)<14 && Link->X > this->X && canMove(this->X+16, this->Y)){
shoot = Screen->LoadFFC(ffc_cycle);
shoot->Data = weapon_combo;
shoot->Y = this->Y; shoot->X = this->X + 16;
shoot->Vx = speed; shoot->Vy=0;
shoot->CSet = cset;
ffc_cycle++;
delay = 30;
}
}
}
Waitframe();
}
}
bool canMove(int x, int y)
{
if(x<0 || x>240 || y<0 || y>160)
return false;
return Screen->ComboS[y+(x>>4)]==0;
}
}
Unlike the Veg-O-Matic, this one is stationary.
Enjoy!
.
And without further ado, I give you more scripts. Yay!
First item up for bid is the enemy_spawner mark III:
//================================================== =====
// ENEMY SPAWNER 3- Will spawn a preset amount of enemies
// from a pool of 3, chosen at random.
// Will place enemies at random locations if walkable.
// D0-D2; Enemies that might spawn,
// D3; Delay in ticks between spawns
// D4; Max number of enemies that will spawn.
// Thanks C-Dawg!
//================================================== =====
ffc script enemyspawner3 {
void run(int e1, int e2, int e3, int delay, int enemy_count ) {
int RandNum = Rand(3);
int en_count = enemy_count;
int counter = delay;
while(en_count > 0){
if ( counter == 0 && RandNum == 0){
putenemy(e1);
counter = delay;
RandNum = Rand(3);
en_count = en_count - 1;
}if ( counter == 0 && RandNum == 1){
putenemy(e2);
counter = delay;
RandNum = Rand(3);
en_count = en_count - 1;
}if ( counter == 0 && RandNum == 2){
putenemy(e3);
counter = delay;
RandNum = Rand(3);
en_count = en_count - 1;
}
counter--;
Waitframe();
} // end of while loop
}
void putenemy(int eid){
int x = Rand(12)+2;
int y = Rand(7)+2;
while(!is_walkable(x,y))
{
x = Rand(12)+2;
y = Rand(7)+2;
}
npc en = Screen->CreateNPC(eid);
if(en->isValid())
{
en->X = x*16;
en->Y = y*16;
}
}
bool is_walkable(int x, int y)
{
return Screen->ComboS[x+y*16]==0;
}
}
This ones sure to be popular with the ladies.
Our next item is the Sentry script. aka; the veg-o-matic! If you use this and still don't know why I call it the veg-o-matic, well, then I know something you don't know. :p
// FFC SCRIPT VEG-O-MATIC---------------------------------------
//D0- vertical guard set 1
//D1- horizontal guard set 1 *NOT BOTH!!!*
//D2- set 1 if can fire weapons
//D3- combo of weapon if d2
//D4- speed of weapon projectile if d2
//D5- time in tics between shots
//D6- CSet of weapon projectile
//D7- the starting ffc to use for projectiles
//---------------------------------------------------------
ffc script Veg_O_Matic{
void run(int vert, int horiz, int armed, int weapon_combo, int speed, int rapid, int cset, int ffc_to_use){
ffc shoot;
int ffc_cycle = ffc_to_use;
int delay = 0;
while(true){
delay++;
if(ffc_cycle >= ffc_to_use+4){ ffc_cycle = ffc_to_use;}
if(vert == 1){ if(this->Y > Link->Y+2){ this->Y--;} if(this->Y < Link->Y-2){ this->Y++;}}
if(horiz == 1){ if(this->X > Link->X+2){ this->X--;} if(this->X < Link->X-2){ this->X++;}}
if(armed == 1){
if(vert == 1){
if(delay == rapid && Link->X > this->X){
shoot = Screen->LoadFFC(ffc_cycle);
shoot->Data = weapon_combo;
shoot->Y = this->Y; shoot->X = this->X + 16;
shoot->Vx = speed;
shoot->CSet = cset;
ffc_cycle++;
delay = 0;
}
if(delay == rapid && Link->X < this->X){
shoot = Screen->LoadFFC(ffc_cycle);
shoot->Data = weapon_combo;
shoot->Y = this->Y; shoot->X = this->X - 16;
shoot->Vx = -speed;
shoot->CSet = cset;
ffc_cycle++;
delay = 0;
}
}
if(horiz == 1){
if(delay == rapid && Link->Y > this->Y){
shoot = Screen->LoadFFC(ffc_cycle);
shoot->Data = weapon_combo;
shoot->Y = this->Y + 16; shoot->X = this->X;
shoot->Vy = speed;
shoot->CSet = cset;
ffc_cycle++;
delay = 0;
}
if(delay == rapid && Link->Y < this->Y){
shoot = Screen->LoadFFC(ffc_cycle);
shoot->Data = weapon_combo;
shoot->Y = this->Y - 16; shoot->X = this->X;
shoot->Vy = -speed;
shoot->CSet = cset;
ffc_cycle++;
delay = 0;
}
}
}
Waitframe();
}
}
}
Ok, Ok, I know what you're thinking right now: "How can I get 255(or is that 256?) enemies on the screen at once and center them on an enemy and set that enemies HP to any obscene amount I want"? Well alrighty then, ask and ye shall recieve.
Flamethrower script:
//=======================================
// FFC SCRIPT FLAMETHROWER
//D0- minions to spawn (id number)
//D1- HP of the summoner
//D2- Max enemies on screen at once
//=======================================
ffc script Flamethrower{
void run(int enemy_id, int enemyHP, int enemy_swarm){
int enemy_number = 0;
npc enemy;
int slow_slowdown=0;
int death = 0;
Waitframes(4);
npc fire_master = Screen->LoadNPC(1);
npc firestorm;
fire_master->HP = enemyHP;
while(true){
if(fire_master->isValid() || fire_master->HP >0){
this->X = fire_master->X; this->Y = fire_master->Y;
if(Screen->NumNPCs() < enemy_swarm){ npc firestorm = Screen->CreateNPC(enemy_id);}
firestorm->X = this->X;
firestorm->Y = this->Y;
}
else{ death = 1;}
enemy_number = Screen->NumNPCs();
while(enemy_number > 1){
enemy = Screen->LoadNPC(enemy_number);
enemy->X = this->X; enemy->Y = this->Y;
if(death == 1){enemy->HP = 0;Screen->ClearSprites(2);}
enemy_number--;
if(enemy_number > 30){
if(slow_slowdown == 0){ slow_slowdown = enemy_number; Waitframe();}
slow_slowdown--;
}
}
Waitframe();
}
}
}
And now to make sure Link walks around in circles while being forced to repeadedly battle these baddies:
Random door generator:
//------------------------------------------------------
// Creates 1-3 closed shutters in a random direction as
// long as there is a wall.-along with a one-way wherever link enters from.
// Once the enemies have been killed the shutter will open.
// This will not overwrite essential doors added for specific dungeon map layouts :)
// For best results run at *SCREEN INIT*
// Not used yet/ -random locked doors, boss doors, open doors-
//------------------------------------------------------
ffc script random_door_generator{ //ver2.1
void run(){
int ddoor = 0;
int udoor = 0;
int ldoor = 0;
int rdoor = 0;
int RandNum = Rand(4);
if (Link->Dir == 0 && Screen->Door[DIR_DOWN] == D_WALL){ ddoor = 1;}
if (Link->Dir == 1 && Screen->Door[DIR_UP] == D_WALL){ udoor = 1;}
if (Link->Dir == 2 && Screen->Door[DIR_RIGHT] == D_WALL){ rdoor = 1;}
if (Link->Dir == 3 && Screen->Door[DIR_LEFT] == D_WALL){ ldoor = 1;}
if (RandNum == 0 && Screen->Door[DIR_DOWN] == D_WALL){ Screen->Door[DIR_DOWN] = D_SHUTTER;}
if (RandNum == 0 && Screen->Door[DIR_UP] == D_WALL){Screen->Door[DIR_UP] = D_SHUTTER;}
if (RandNum == 1 && Screen->Door[DIR_RIGHT] == D_WALL){Screen->Door[DIR_RIGHT] = D_SHUTTER;}
if (RandNum == 1 && Screen->Door[DIR_LEFT] == D_WALL){Screen->Door[DIR_LEFT] = D_SHUTTER; }
if (RandNum == 2 && Screen->Door[DIR_DOWN] == D_WALL){Screen->Door[DIR_DOWN] = D_SHUTTER;}
if (RandNum == 2 && Screen->Door[DIR_UP] == D_WALL){Screen->Door[DIR_UP] = D_SHUTTER;}
if (RandNum == 2 && Screen->Door[DIR_RIGHT] == D_WALL){Screen->Door[DIR_RIGHT] = D_SHUTTER;}
if (RandNum == 3 && Screen->Door[DIR_LEFT] == D_WALL){Screen->Door[DIR_LEFT] = D_SHUTTER;}
if (RandNum == 3 && Screen->Door[DIR_RIGHT] == D_WALL){Screen->Door[DIR_RIGHT] = D_SHUTTER;}
if (RandNum == 3 && Screen->Door[DIR_UP] == D_WALL){Screen->Door[DIR_UP] = D_SHUTTER; }
if (ddoor == 1){Screen->Door[DIR_DOWN] = D_1WAYSHUTTER;}
if (udoor == 1){Screen->Door[DIR_UP] = D_1WAYSHUTTER;}
if (rdoor == 1){Screen->Door[DIR_RIGHT] = D_1WAYSHUTTER;}
if (ldoor == 1){Screen->Door[DIR_LEFT] = D_1WAYSHUTTER; }
}
}
2.6 Armos script:
//======================================
// -ffc script Armos-
//D0 - id of enemy to create
//D1 - HP of created enemy
//======================================
ffc script Armos{
void run(int enemy_id, int enemyHP){
int trigger = 0;
npc armos;
while(true){
if(trigger == 0){
if( Abs(Link->X - this->X) <= 16 && Abs(Link->Y - this->Y) <= 16){
npc armos = Screen->CreateNPC(enemy_id);
armos->X = this->X; armos->Y = this->Y;
armos->HP = enemyHP;
this->Data=0;trigger=1;
}
}
Waitframe();
}
}
}
New one, Custom Armos. This one will get used...alot. I'm sure of it. ;)
I guess it's true with scripts anyway; It's not how big it is, it's how you use it. :laughing:
//================================================== ================================
// FFC SCRIPT SENTRY
//
// D0 - Direction can shoot / values greater than 3 return up,down,left,right.
// D1 - combo of weapon projectile
// D2 - speed of projectile
// D3 - CSet of projectile
// D4 - First of 3 ffc's to use as projectiles
//================================================== ================================
ffc script Sentry{
void run(int shoot_dir, int weapon_combo, int speed, int cset, int ffc_to_use){
ffc shoot;
int ffc_cycle = ffc_to_use;
int delay = 0;
while(true){
if(ffc_cycle >= ffc_to_use+3){ ffc_cycle = ffc_to_use;}
if(delay > 0){delay--;}
if(shoot_dir > 3 && delay == 0){
if(Abs(Link->X-this->X)<14 && Link->Y < this->Y && canMove(this->X, this->Y-16)) // Up
{
shoot = Screen->LoadFFC(ffc_cycle);
shoot->Data = weapon_combo;
shoot->Y = this->Y - 16; shoot->X = this->X;
shoot->Vy = -speed; shoot->Vx=0;
shoot->CSet = cset;
ffc_cycle++;
delay = 30;
}
else if(Abs(Link->X-this->X)<14 && Link->Y > this->Y && canMove(this->X, this->Y+16)) // Down
{
shoot = Screen->LoadFFC(ffc_cycle);
shoot->Data = weapon_combo;
shoot->Y = this->Y + 16; shoot->X = this->X;
shoot->Vy = speed; shoot->Vx=0;
shoot->CSet = cset;
ffc_cycle++;
delay = 30;
}
else if(Abs(Link->Y-this->Y)<14 && Link->X < this->X && canMove(this->X-16, this->Y)) // Left
{
shoot = Screen->LoadFFC(ffc_cycle);
shoot->Data = weapon_combo;
shoot->Y = this->Y; shoot->X = this->X - 16;
shoot->Vx = -speed; shoot->Vy=0;
shoot->CSet = cset;
ffc_cycle++;
delay = 30;
}
else if(Abs(Link->Y-this->Y)<14 && Link->X > this->X && canMove(this->X+16, this->Y)) // Right
{
shoot = Screen->LoadFFC(ffc_cycle);
shoot->Data = weapon_combo;
shoot->Y = this->Y; shoot->X = this->X + 16;
shoot->Vx = speed; shoot->Vy=0;
shoot->CSet = cset;
ffc_cycle++;
delay = 30;
}
}
else{
if(shoot_dir==0 && delay == 0){
if(Abs(Link->X-this->X)<14 && Link->Y < this->Y && canMove(this->X, this->Y-16)){
shoot = Screen->LoadFFC(ffc_cycle);
shoot->Data = weapon_combo;
shoot->Y = this->Y - 16; shoot->X = this->X;
shoot->Vy = -speed; shoot->Vx=0;
shoot->CSet = cset;
ffc_cycle++;
delay = 30;
}
}
else if(shoot_dir==1 && delay == 0){
if(Abs(Link->X-this->X)<14 && Link->Y > this->Y && canMove(this->X, this->Y+16)){
shoot = Screen->LoadFFC(ffc_cycle);
shoot->Data = weapon_combo;
shoot->Y = this->Y + 16; shoot->X = this->X;
shoot->Vy = speed; shoot->Vx=0;
shoot->CSet = cset;
ffc_cycle++;
delay = 30;
}
}
else if(shoot_dir==2 && delay == 0){
if(Abs(Link->Y-this->Y)<14 && Link->X < this->X && canMove(this->X-16, this->Y)){
shoot = Screen->LoadFFC(ffc_cycle);
shoot->Data = weapon_combo;
shoot->Y = this->Y; shoot->X = this->X - 16;
shoot->Vx = -speed; shoot->Vy=0;
shoot->CSet = cset;
ffc_cycle++;
delay = 30;
}
}
else if(shoot_dir==3 && delay == 0){
if(Abs(Link->Y-this->Y)<14 && Link->X > this->X && canMove(this->X+16, this->Y)){
shoot = Screen->LoadFFC(ffc_cycle);
shoot->Data = weapon_combo;
shoot->Y = this->Y; shoot->X = this->X + 16;
shoot->Vx = speed; shoot->Vy=0;
shoot->CSet = cset;
ffc_cycle++;
delay = 30;
}
}
}
Waitframe();
}
}
bool canMove(int x, int y)
{
if(x<0 || x>240 || y<0 || y>160)
return false;
return Screen->ComboS[y+(x>>4)]==0;
}
}
Unlike the Veg-O-Matic, this one is stationary.
Enjoy!
.