Code:
ffc script boss_patralike{
void run(){
int d=2590;int delay;
float wii;bool lasers;
int n;int f;bool normal=true;
int r=80;int radx;int rady;
this->X=112;this->Y=80;
int outer_state;
int inner_state;
int movement;
int counter;
int attack_counter;
int speed1;int speed2;
int deg;int s;
int color=2;
int z;int q;
for(int i=1;i<=32;i++){
boss_check[i]=0;
}
Screen->Quake=210;
int play_sfx;
for(int i=0;i<160;i++){
if(Rand(15)==0)Screen->DrawTile(6,0,24,12740,16,8,0,1,0,0,0,0,true,128);
else Screen->DrawTile(6,0,24,12740,16,8,0,1,0,0,0,0,true,64);
if(play_sfx>0)play_sfx--;
else{ play_sfx=50; Game->PlaySound(SFX_DOOMHORN1);}
Waitframe();
}
if(GAME_MODE<4)Refill();
int x=112; int y=-80;
int eye_x=15;int eye_y=10;
for(int p;p<640||y<80;p++){
Waitframe();
for(int i;i<12;i++){
Screen->DrawTile(2,x+(120*Sin(i*30)),y+(80*Cos(i*30)),7558,2,2,11,1,0,0,0,0,true,128);
if(i<10)Screen->DrawTile(2,120+(15*Sin(i*36)),y+(10*Cos(i*36)),5641,1,1,11,1,0,0,0,0,true,128);
}
y+=0.25;
}
ffc F;
int fx;int fy;
float w;
for(int i;i<10;i++){
F=Screen->LoadFFC(i+22);
F->Data=2576;
}
ffc boss=Screen->LoadFFC(2);
boss->Data=2578;
boss->CSet=0;
x=112;y=80;
ffc f10 = Screen->LoadFFC(10);f10->Data=d;f10->CSet=0;
f10->TileWidth=2;f10->TileHeight=2;f10->EffectWidth=32;f10->EffectHeight=32;
ffc f11 = Screen->LoadFFC(11);f11->Data=d+40;f11->CSet=1;
f11->TileWidth=2;f11->TileHeight=2;f11->EffectWidth=32;f11->EffectHeight=32;
ffc f12 = Screen->LoadFFC(12);f12->Data=d+80;f12->CSet=6;
f12->TileWidth=2;f12->TileHeight=2;f12->EffectWidth=32;f12->EffectHeight=32;
ffc f13 = Screen->LoadFFC(13);f13->Data=d;f13->CSet=0;
f13->TileWidth=2;f13->TileHeight=2;f13->EffectWidth=32;f13->EffectHeight=32;
ffc f14 = Screen->LoadFFC(14);f14->Data=d+40;f14->CSet=1;
f14->TileWidth=2;f14->TileHeight=2;f14->EffectWidth=32;f14->EffectHeight=32;
ffc f15 = Screen->LoadFFC(15);f15->Data=d+80;f15->CSet=6;
f15->TileWidth=2;f15->TileHeight=2;f15->EffectWidth=32;f15->EffectHeight=32;
ffc f16 = Screen->LoadFFC(16);f16->Data=d;f16->CSet=0;
f16->TileWidth=2;f16->TileHeight=2;f16->EffectWidth=32;f16->EffectHeight=32;
ffc f17 = Screen->LoadFFC(17);f17->Data=d+40;f17->CSet=1;
f17->TileWidth=2;f17->TileHeight=2;f17->EffectWidth=32;f17->EffectHeight=32;
ffc f18 = Screen->LoadFFC(18);f18->Data=d+80;f18->CSet=6;
f18->TileWidth=2;f18->TileHeight=2;f18->EffectWidth=32;f18->EffectHeight=32;
ffc f19 = Screen->LoadFFC(19);f19->Data=d;f19->CSet=0;
f19->TileWidth=2;f19->TileHeight=2;f19->EffectWidth=32;f19->EffectHeight=32;
ffc f20 = Screen->LoadFFC(20);f20->Data=d+40;f20->CSet=1;
f20->TileWidth=2;f20->TileHeight=2;f20->EffectWidth=32;f20->EffectHeight=32;
ffc f21 = Screen->LoadFFC(21);f21->Data=d+80;f21->CSet=6;
f21->TileWidth=2;f21->TileHeight=2;f21->EffectWidth=32;f21->EffectHeight=32;
eweapon ew_sprite;
eweapon laser;
npc enemy=Screen->CreateNPC(255);
enemy->HP=500;enemy->CSet=11;
enemy->ColWidth=6;enemy->ColHeight=6;
enemy->ColXOffset=5;enemy->ColYOffset=5;
bool invulnerability=true;
float cx; float cy; float a;
int sprite_state;
bool final_attack;
while(true){
Waitframe();
int lx = Link->X;int ly = Link->Y;
int tx = this->X;int ty = this->Y;
boss->X=tx+8;boss->Y=ty;
boss_check[1]=tx+8;boss_check[2]=ty;
delay++;
if(invulnerability){
enemy->X=boss->X;enemy->Y=boss->Y;
if(enemy->HP<500)enemy->HP=500;
Screen->Rectangle(5,20,2,20+((enemy->HP)/2.3),4,104,1,0,0,0,true,128);
}
else{
if(enemy->isValid()){
Screen->Rectangle(5,20,2,20+((enemy->HP)/2.3),4,104,1,0,0,0,true,128);
enemy->X=boss->X;enemy->Y=boss->Y;
}
else{
wait(120);
for(int v;v<5;v++){
Game->PlaySound(SFX_BOMB2);
for(int i=10;i<32;i++){
F=Screen->LoadFFC(i);
F->TileWidth=3;F->TileHeight=3;
F->Data=EXPLODE3+Rand(12);
wait(5);
if(Rand(22)==0)Game->PlaySound(SFX_BOMB3);
}
Game->PlaySound(SFX_BOMB3);
}
this->Data = Y_EXPLODE;
int screen=Game->GetCurDMapScreen();
wait(120);
Link->PitWarp(10,screen+1);
}
}
if(movement==1){
}
else if(movement==2){
this->X = (112) + ((z) * Sin(q));
this->Y = (80) + ((z) * Cos(q));
z+=0.1;q++;
if(z==50)movement=3;
}
else if(movement==3){
this->X = (112) + ((z) * Sin(q));
this->Y = (80) + ((z) * Cos(q));
z-=0.1;q++;
if(z==0)movement=4;
}
else if(movement==4){
this->X = (112) + ((z) * Sin(q));
this->Y = (80) + ((z) * Cos(q));
z+=0.1;q++;
if(z==50)movement=5;
}
else if(movement==5){
this->X = (112) + ((z) * Sin(q));
this->Y = (80) + ((z) * Cos(q));
z-=0.1;q++;
if(z==0)movement=6;
}
else if(movement==6){
this->X = (112) + ((z) * Sin(q));
this->Y = (80) + ((z) * Cos(q));
z+=0.1;q++;
if(z==50)movement=7;
}
else if(movement==7){
this->X = (112) + ((z) * Sin(q));
this->Y = (80) + ((z) * Cos(q));
z-=0.1;q++;
if(z==0){
movement=1;
outer_state=4;
inner_state=4;
}
}
if(outer_state==0){
for(int i=0;i<12;i++){
F=Screen->LoadFFC(i+10);
F->X = tx+(x*Sin(wii+(i*30)));
F->Y = ty+(y*Cos(wii+(i*30)));
}
if(delay<200)wii-=0.1;
else if(delay<300)wii-=0.15;
else if(delay<400)wii-=0.24;
else if(delay<500)wii-=0.33;
else if(delay<600)wii-=0.42;
else wii-=0.5;
if(delay>750){
delay=0;
outer_state=1;
inner_state=1;
for(int i=0;i<12;i++){
F=Screen->LoadFFC(i+10);
if(F->Data>200)F->Data+=6;
}
}
}
else if(outer_state==1){
for(int i=0;i<12;i++){
F=Screen->LoadFFC(i+10);
F->X = tx+(x*Sin(wii+(i*30)));
F->Y = ty+(y*Cos(wii+(i*30)));
}
if(delay<100)wii-=0.5;
else if(delay<200)wii-=0.6;
else if(delay<300)wii-=0.7;
else if(delay<400)wii-=0.8;
else if(delay<500)wii-=0.9;
else wii--;
if(delay>1000){
delay=0;
outer_state=2;
inner_state=2;
Game->PlaySound(SFX_DOOMHORN2);
for(int i=0;i<12;i++){
F=Screen->LoadFFC(i+10);
if(F->Data>200)F->Data+=2;
}
}
}
else if(outer_state==2){ // Retracting
for(int i=0;i<12;i++){
F=Screen->LoadFFC(i+10);
F->X = tx+(x*Sin(wii+(i*30)));
F->Y = ty+(y*Cos(wii+(i*30)));
}
wii--;
x-=0.3;
y-=0.2;
if(y<=28){
delay=0;
outer_state=3;
inner_state=3;
movement=2;
}
}
else if(outer_state==3){
for(int i=0;i<12;i++){
F=Screen->LoadFFC(i+10);
F->X = tx+(x*Sin(wii+(i*30)));
F->Y = ty+(y*Cos(wii+(i*30)));
}
if(delay<100)wii-=1.0;
else if(delay<200)wii-=1.1;
else if(delay<300)wii-=1.2;
else if(delay<400)wii-=1.3;
else if(delay<500)wii-=1.4;
else wii-=1.5;
}
else if(outer_state==4){ // Expanding
for(int i=0;i<12;i++){
F=Screen->LoadFFC(i+10);
F->X = tx+(x*Sin(wii+(i*30)));
F->Y = ty+(y*Cos(wii+(i*30)));
}
wii-=1.5;
x+=0.3;
y+=0.2;
if(y>=80){
delay=0;
outer_state=5;
inner_state=5;
Game->PlaySound(SFX_WARPED2);
}
}
else if(outer_state==5){
for(int i=0;i<12;i++){
F=Screen->LoadFFC(i+10);
F->X = tx+(x*Sin(wii+(i*30)));
F->Y = ty+(y*Cos(wii+(i*30)));
}
wii-=1.5;
if(delay>800){
delay=0;
outer_state=2;
inner_state=2;
Game->PlaySound(SFX_DOOMHORN2);
}
}
if(inner_state==0){
for(int i;i<10;i++){
F=Screen->LoadFFC(i+22);
F->X=(tx+8)+(eye_x*Sin(w+(i*36)));
F->Y=ty+(eye_y*Cos(w+(i*36)));
}
if(delay<200)w+=0.1;
else if(delay<350)w+=0.15;
else if(delay<550)w+=0.2;
else if(delay<750)w+=0.25;
else if(delay<950)w+=0.4;
else w+=0.5;
}
else if(inner_state==1){
for(int i;i<10;i++){
F=Screen->LoadFFC(i+22);
F->X=(tx+8)+(eye_x*Sin(w+(i*36)));
F->Y=ty+(eye_y*Cos(w+(i*36)));
}
if(delay<100)w+=0.5;
else if(delay<200)w+=0.6;
else if(delay<300)w+=0.7;
else if(delay<400)w+=0.8;
else if(delay<500)w+=0.9;
else w++;
}
else if(inner_state==2){
for(int i;i<10;i++){
F=Screen->LoadFFC(i+22);
F->X=(tx+8)+(eye_x*Sin(w+(i*36)));
F->Y=ty+(eye_y*Cos(w+(i*36)));
}
w++;
eye_x+=0.3;
eye_y+=0.2;
}
else if(inner_state==3){
for(int i;i<10;i++){
F=Screen->LoadFFC(i+22);
F->X=(tx+8)+(eye_x*Sin(w+(i*36)));
F->Y=ty+(eye_y*Cos(w+(i*36)));
}
if(delay<150)w+=1.0;
else if(delay<300)w+=1.1;
else if(delay<450)w+=1.2;
else if(delay<600)w+=1.3;
else if(delay<750)w+=1.4;
else w+=1.5;
}
else if(inner_state==4){
for(int i;i<10;i++){
F=Screen->LoadFFC(i+22);
F->X=(tx+8)+(eye_x*Sin(w+(i*36)));
F->Y=ty+(eye_y*Cos(w+(i*36)));
}
w+=1.5;
eye_x-=0.3;
eye_y-=0.2;
}
else if(inner_state==5){
for(int i;i<10;i++){
F=Screen->LoadFFC(i+22);
F->X=(tx+8)+(eye_x*Sin(w+(i*36)));
F->Y=ty+(eye_y*Cos(w+(i*36)));
}
w+=1.5;
}
if(lasers){
if(!final_attack){
cx = boss->X;
cy = boss->Y;
Game->PlaySound(SFX_LIGHTNING);
if(enemy->HP<320){final_attack=true;counter=90;}
if(sprite_state==0){ // blue
if(counter>0){
counter--;
laser = Screen->CreateEWeapon(EW_MAGIC);
laser->ColWidth=4;laser->ColHeight=4;laser->ColXOffset=6;laser->ColYOffset=6;
laser->X=cx + 30 * Sin(a);laser->Y=cy + 30 * Cos(a);
laser->Step=1;laser->Damage=2;laser->CSet=0;
laser->Angular=true;laser->Tile=1300;
laser->Angle=ArcTan(cx-laser->X,cy-laser->Y);
a-=6;
}
else{sprite_state=1;counter=60;}
}
if(sprite_state==1){ // red
if(counter>0){
counter--;
laser = Screen->CreateEWeapon(EW_MAGIC);
laser->ColWidth=4;laser->ColHeight=4;laser->ColXOffset=6;laser->ColYOffset=6;
laser->X=cx + 30 * Sin(a);laser->Y=cy + 30 * Cos(a);
laser->Step=1;laser->Damage=2;laser->CSet=1;
laser->Angular=true;laser->Tile=1320;
laser->Angle=ArcTan(cx-laser->X,cy-laser->Y);
a-=6;
}
else{sprite_state=2;counter=60;}
}
if(sprite_state==2){ // green
if(counter>0){
counter--;
laser = Screen->CreateEWeapon(EW_MAGIC);
laser->ColWidth=4;laser->ColHeight=4;laser->ColXOffset=6;laser->ColYOffset=6;
laser->X=cx + 30 * Sin(a);laser->Y=cy + 30 * Cos(a);
laser->Step=1;laser->Damage=2;laser->CSet=6;
laser->Angular=true;laser->Tile=1340;
laser->Angle=ArcTan(cx-laser->X,cy-laser->Y);
a-=6;
}
else{sprite_state=0;counter=60;}
}
}
else{
if(GAME_MODE>EASY){
int tx_r = tx+16;
r = ty;
Screen->Rectangle(2,tx-120,r ,tx+136,r+10,2,1,tx_r,r+5,n,true,64);
Screen->Rectangle(2,tx-120,r+1,tx+136,r+9,5,1,tx_r,r+4,n,true,64);
Screen->Rectangle(2,tx-120,r+2,tx+136,r+8,7,1,tx_r,r+3,n,true,64);
Screen->Rectangle(2,tx-120,r+3,tx+136,r+8,10,1,tx_r,r+2,n,true,64);
Screen->Rectangle(2,tx-110,r ,tx+146,r+10,17,1,tx_r,r+5,n+90,true,64);
Screen->Rectangle(2,tx-110,r+1,tx+146,r+9,19,1,tx_r,r+4,n+90,true,64);
Screen->Rectangle(2,tx-110,r+2,tx+146,r+8,21,1,tx_r,r+3,n+90,true,64);
Screen->Rectangle(2,tx-110,r+3,tx+146,r+8,23,1,tx_r,r+2,n+90,true,64);
for(int i=8;i<128;i+=8){
radx = tx_r + (i * Sin(n-90));
rady = r + (i * Cos(n+90));
if(Abs(lx-radx)<9&&Abs(ly-rady)<9){
if(white && polarity_shield){
if(Link->MP<Link->MaxMP)Link->MP++;
Game->PlaySound(23);
}
else {Link->HP--;Game->PlaySound(19);}
}
radx = tx_r - (i * Sin(n-90));
rady = r - (i * Cos(n+90));
if(Abs(lx-radx)<9&&Abs(ly-rady)<9){
if(white && polarity_shield){
if(Link->MP<Link->MaxMP)Link->MP++;
Game->PlaySound(23);
}
else {Link->HP--;Game->PlaySound(19);}
}
radx = tx_r + (i * Sin(n));
rady = r + (i * Cos(n+180));
if(Abs(lx-radx)<9&&Abs(ly-rady)<9){
if(black && polarity_shield){
if(Link->MP<Link->MaxMP)Link->MP++;
Game->PlaySound(23);
}
else {Link->HP--;Game->PlaySound(19);}
}
radx = tx_r - (i * Sin(n));
rady = r - (i * Cos(n+180));
if(Abs(lx-radx)<9&&Abs(ly-rady)<9){
if(black && polarity_shield){
if(Link->MP<Link->MaxMP)Link->MP++;
Game->PlaySound(23);
}
else {Link->HP--;Game->PlaySound(19);}
}
}
n++;
}
if(counter>0){
for(int i;i<10;i++){
F=Screen->LoadFFC(i+22);
fx=F->X+8;fy=F->Y+8;
Screen->Circle(5,fx,fy,counter/2,color,1,0,0,0,false,128);
Screen->Circle(5,fx,fy,counter,color,1,0,0,0,false,128);
}
counter--;
Game->PlaySound(SFX_SKEW);
}
else{
if(attack_counter>0){
for(int i;i<10;i++){
F=Screen->LoadFFC(i+22);
fx=F->X+8;fy=F->Y+8;
Screen->Line(5,lx+8,ly+8,fx,fy,color,1,0,0,0,64);
}
if(color==2){
if(white && polarity_shield){
if(Link->MP<Link->MaxMP)Link->MP++;
Game->PlaySound(23);
}
else {Link->HP--;Game->PlaySound(19);}
}
else{
if(black && polarity_shield){
if(Link->MP<Link->MaxMP)Link->MP++;
Game->PlaySound(23);
}
else {Link->HP--;Game->PlaySound(19);}
}
attack_counter--;
}
else{
if(color==2){
color=20;
for(int i;i<10;i++){
F=Screen->LoadFFC(i+22);
F->Data++;
}
boss->Data++;
boss->CSet++;
}
else{
color=2;
for(int i;i<10;i++){
F=Screen->LoadFFC(i+22);
F->Data--;
}
boss->Data--;
boss->CSet--;
}
speed1+=0.5;speed2+=0.25;
if(speed1>30)counter=30;
else counter=60-speed1;
if(speed2>15)attack_counter=15;
else attack_counter=30-speed2;
Game->PlaySound(SFX_EVILGUN);
}
}
if(GAME_MODE==HARD){
if(s>0)s--;
else{
laser = Screen->CreateEWeapon(EW_MAGIC);laser->ColWidth=4;laser->ColHeight=4;
laser->X=tx+8;laser->Y=ty;laser->Step=2;laser->Damage=2;
laser->CSet=boss->CSet;laser->ColXOffset=6;laser->ColYOffset=6;
laser->Angular=true;laser->Angle = deg*(PI/180);
laser = Screen->CreateEWeapon(EW_MAGIC);laser->ColWidth=4;laser->ColHeight=4;
laser->X=tx+8;laser->Y=ty;laser->Step=2;laser->Damage=2;
laser->CSet=boss->CSet;laser->ColXOffset=6;laser->ColYOffset=6;
laser->Angular=true;laser->Angle = (deg+180)*(PI/180);
deg-=4;s=2;
Game->PlaySound(SFX_SUMMON);
}
}
}
}
else{
int ew_num = Screen->NumEWeapons();
for(int e = ew_num; e>0; e--){
ew_sprite = Screen->LoadEWeapon(e);
if(Abs((tx+8)-ew_sprite->X)<10 && Abs(ty-ew_sprite->Y)<10){
ew_sprite->DeadState=0;
}
}
for(int i=0;i<12;i++){
F=Screen->LoadFFC(i+10);
if(F->Data==1 && boss_check[i+10]!=99){
boss_check[i+10]=99;
boss_check[32]++;
}
}
if(boss_check[32]>=12){lasers=true;counter=60;attack_counter=30;invulnerability=false;}
}
// BUGFIX
for(int i;i<10;i++){
F=Screen->LoadFFC(i+22);
if(F->Data<4){
if(F->CSet==0)F->Data=2576;
else F->Data=2577;
}
}
}
}
}
Code:
if(z<1200){
for(int i;i<120;i++){
Screen->PutPixel(2,x+(a*Sin(b-i)),y+(c*Cos(d-i)),8,0,0,0,64);
Screen->PutPixel(2,x+(a*Sin(b-i+180)),y+(c*Cos(d-i+180)),7,0,0,0,64);
a++;c++;
cir_x = x + (44*Sin(b+90));
cir_y = y + (44*Cos(d+90));
Screen->PutPixel(2,cir_x+(8*Sin((b*3)+(i*2.5))),cir_y+(8*Cos((b*3)+(i*2.5))),9,0,0,0,64);
cir_x = x + (44*Sin(b+270));
cir_y = y + (44*Cos(d+270));
Screen->PutPixel(2,cir_x+(8*Sin((b*3)-(i*2.5))),cir_y+(8*Cos((d*3)-(i*2.5))),9,0,0,0,64);
}
for(int i;i<360;i++){
Screen->PutPixel(1,x+(z*Sin(i)),y+(z*Cos(i)),8,0,0,0,64);
}
z++;
if(z>160)z=0;
}
a=0;c=0;
b+=2;d+=2;
Waitframe();