Author Topic: I don't even know what this is anymore  (Read 4910 times)

Drake

  • *
I don't even know what this is anymore
« on: October 22, 2009, 05:23:38 AM »
But it's amazing.

...Inspired from Windows XP bezier screensaver...?

EDIT: As it stands you need invincibility.

Code: [Select]
#TouhouDanmakufu
#Title[what is this]
#Text[i don't even]
#ScriptVersion[2]

script_enemy_main{
let frame = 0;

let ang1 = 90;
let ang2 = 270;
let pos1x = GetCenterX + (50*cos(ang1));
let pos1y = GetCenterY + (50*sin(ang1));
let pos2x = GetCenterX + (100*cos(ang2));
let pos2y = GetCenterY + (100*sin(ang2));

    @Initialize{
        SetLife(10000);
SetScore(1);

bezier(pos1x,pos1y,pos2x,pos2y,90,5,1);
    }

    @MainLoop{
yield;
    }
    @DrawLoop{}
    @Finalize{}

    @BackGround{}

task bezier(x1,y1,x2,y2,p,b,n){
    let a;
    let pos2x = x2;
    let pos2y = y2;
    let pos1x = x1;
    let pos1y = y1;
    let bx;
    let by;
    let dist = 50;
    let distmrk = 1;

    while(frame>=-1){
if(dist<=150 && distmrk==1){
    distmrk=1;
}else if(dist>150 && distmrk==1){
    distmrk=-1;
}else if(dist<=150 && distmrk==-1){
    distmrk=-1;
}else if(dist<=0 && distmrk==-1){
    distmrk=1;
}
dist+=(2*distmrk);
ang1-=2;
ang2+=3;
pos1x = GetCenterX + (dist*cos(ang1));
pos1y = GetCenterY + (dist*sin(ang1));
pos2x = GetCenterX + (100*cos(ang2));
pos2y = GetCenterY + (100*sin(ang2));
a = atan2(pos2y-pos1y,pos2x-pos1x) + p;
if(frame%n==0){
    ascent(i in (b*-1)..b){
bx = pos2x + (i*3*cos(a));
by = pos2y + (i*3*sin(a));
CreateShot01(bx,by,0.5,(a-p),RED12,n);
    }
}
    frame++;
    yield;
    }
}//end bezier

}//end script

Mess around with the values as you see fit. If you can understand what's going on, that is.

EDIT: By the way there's so much room for customization in here you don't even know. The two main angles, the perpendicular line the bullets spawn on, how many bullets spawn and from what distance from each other, the distance between the two points, how the points themselves even move, firing pattern (hell the bullets are only Create01), etc. So much room.
« Last Edit: October 22, 2009, 05:32:02 AM by Drake »

A Colorful Calculating Creative and Cuddly Crafty Callipygous Clever Commander
- original art by Aiけん | ウサホリ -

PT8Sceptile

  • All hail Giant Catfish!
Re: I don't even know what this is anymore
« Reply #1 on: October 22, 2009, 07:34:40 AM »
This is ridiculously awesome!

Code: [Select]
#TouhouDanmakufu
#Title[This is awesome!]
#Text[The title says it all...]
#ScriptVersion[2]

script_enemy_main{
let frame = 0;

let colrs = [RED12, GREEN12, BLUE12, PURPLE12, YELLOW12, AQUA12];

    @Initialize{
        SetLife(10000);
SetScore(1);
SetMovePosition01(GetCenterX, GetCenterY - 60, 3);

bezier(GetCenterX, GetCenterY + 20 - 60, GetCenterX, GetCenterY - 40 - 60,85,3,1,0);
bezier(GetCenterX, GetCenterY - 20 - 60, GetCenterX, GetCenterY + 40 - 60,85,3,1,0);
bezier(GetCenterX + 20, GetCenterY - 60, GetCenterX - 40, GetCenterY - 60,85,3,1,0);
bezier(GetCenterX - 20, GetCenterY - 60, GetCenterX + 40, GetCenterY - 60,85,3,1,0);
    }

    @MainLoop{
SetCollisionA(GetX, GetY, 32);
SetCollisionB(GetX, GetY, 16);
frame++;
yield;
    }
    @DrawLoop{}
    @Finalize{}

    @BackGround{}

task bezier(x1,y1,x2,y2,p,b,n,o){
    let a;
    let pos2x = x2;
    let pos2y = y2;
    let pos1x = x1;
    let pos1y = y1;
    let bx;
    let by;
    let dist = 25;
    let distmrk = 1;

let ang1 = atan2(y1, x1);
let ang2 = atan2(y2, x2);
let inang = atan2(y2-y1, x2-x1);

let sidx = 30*cos(inang);
let sidy = 30*sin(inang);

    while(frame>=-1){
if(dist<=150 && distmrk==1){
distmrk=1;
}else if(dist>150 && distmrk==1){
distmrk=-1;
}else if(dist<=150 && distmrk==-1){
distmrk=-1;
}else if(dist<=0 && distmrk==-1){
distmrk=1;
}
dist+=(2*distmrk);
ang1-=8;
ang2+=12;
pos1x = GetCenterX + (dist*cos(ang1));
pos1y = GetCenterY -60 + (dist*sin(ang1));
pos2x = GetCenterX + ((50+sidx)*cos(ang2));
pos2y = GetCenterY -60 + ((50+sidy)*sin(ang2));
a = atan2(pos2y-pos1y,pos2x-pos1x) + p;
let offang = rand(-10, 10);
let colr = colrs[rand_int(0, length(colrs) - 1)];
if(frame%n==o){
ascent(i in (b*-1)..b){
bx = pos2x + (i*3*cos(a));
by = pos2y + (i*3*sin(a));
CreateShot01(bx,by,3,(a-p) + offang,colr,n + 5);
}
}
yield;
    }
}//end bezier

}//end script

Merely a short time of fiddling around with the script resulted in this. And it's still only CreateShot01...

EDIT: More, this is seriously fun.

Code: [Select]
#TouhouDanmakufu
#Title[This is too awesome!]
#Text[The title says it all...]
#ScriptVersion[2]

script_enemy_main{
let frame = 0;

    @Initialize{
        SetLife(10000);
SetScore(1);
SetMovePosition01(GetCenterX, GetCenterY - 60, 3);

bezier(GetCenterX, GetCenterY - 60 + 20, GetCenterX, GetCenterY - 60 - 20,85,1,1,0, 0,GREEN12);
bezier(GetCenterX, GetCenterY - 60 + 40, GetCenterX, GetCenterY - 40 - 20,85,1,1,0, 1,AQUA12);
bezier(GetCenterX + 20, GetCenterY - 60, GetCenterX - 20, GetCenterY - 60,85,1,1,0, 2,BLUE12);
bezier(GetCenterX + 40, GetCenterY - 60, GetCenterX - 40, GetCenterY - 60,85,1,1,0, 3,PURPLE12);
    }

    @MainLoop{
SetCollisionA(GetX, GetY, 32);
SetCollisionB(GetX, GetY, 16);
frame++;
yield;
    }
    @DrawLoop{}
    @Finalize{}

    @BackGround{}

task bezier(x1,y1,x2,y2,p,b,n,o,an,c){
    let a;
    let pos2x = x2;
    let pos2y = y2;
    let pos1x = x1;
    let pos1y = y1;
    let bx;
    let by;
    let dist = 90;
    let distmrk = 1;

let ang1 = atan2(y1, x1);
let ang2 = atan2(y2, x2);

    while(frame>=-1){
if(dist<=150 && distmrk==1){
distmrk=1;
}else if(dist>150 && distmrk==1){
distmrk=-1;
}else if(dist<=150 && distmrk==-1){
distmrk=-1;
}else if(dist<=0 && distmrk==-1){
distmrk=1;
}
dist+=(2*distmrk);
ang1-=8;
ang2+=12-an;
pos1x = GetCenterX + (dist*cos(ang1));
pos1y = GetCenterY -60 + (dist*sin(ang1));
pos2x = GetCenterX + (50*cos(ang2));
pos2y = GetCenterY -60 + (50*sin(ang2));
a = atan2(pos2y-pos1y,pos2x-pos1x) + p;
if(frame%n==o){
ascent(i in 0..b){
bx = pos2x;
by = pos2y;
CreateShot01(bx,by,0.5,(a-p) + 360*i/b,c,n + 5);
}
}
yield;
    }
}//end bezier

}//end script

EDIT2: Another test provided yet another interesting effect. If you're going to try these, don't worry about the fact that #1 and #3 are practically impossible.

Code: [Select]
#TouhouDanmakufu
#Title[This is way too awesome!]
#Text[The title says it all...]
#ScriptVersion[2]

script_enemy_main{
let frame = 0;

let colrs = [RED12, GREEN12, BLUE12, PURPLE12, YELLOW12, AQUA12];

    @Initialize{
        SetLife(10000);
SetScore(1);
SetMovePosition01(GetCenterX, GetCenterY - 60, 3);

bezier(GetCenterX, GetCenterY - 80 - 60, GetCenterX, GetCenterY + 80 - 60,90,1,2,1);
bezier(GetCenterX, GetCenterY - 80 - 60, GetCenterX, GetCenterY + 80 - 60,90,2,2,2);
bezier(GetCenterX, GetCenterY - 80 - 60, GetCenterX, GetCenterY + 80 - 60,90,3,2,3);
bezier(GetCenterX, GetCenterY - 80 - 60, GetCenterX, GetCenterY + 80 - 60,90,4,2,4);
bezier(GetCenterX, GetCenterY - 80 - 60, GetCenterX, GetCenterY + 80 - 60,90,5,2,5);
    }

    @MainLoop{
SetCollisionA(GetX, GetY, 32);
SetCollisionB(GetX, GetY, 16);
frame++;
yield;
    }
    @DrawLoop{}
    @Finalize{}

    @BackGround{}

task bezier(x1,y1,x2,y2,p,b,n,o){
    let a;
    let pos2x = x2;
    let pos2y = y2;
    let pos1x = x1;
    let pos1y = y1;
    let bx;
    let by;
    let dist = 25;
    let distmrk = 1;

let ang1 = atan2(y1, x1);
let ang2 = atan2(y2, x2);

    while(frame>=-1){
if(dist<=150 && distmrk==1){
distmrk=1;
}else if(dist>150 && distmrk==1){
distmrk=-1;
}else if(dist<=150 && distmrk==-1){
distmrk=-1;
}else if(dist<=0 && distmrk==-1){
distmrk=1;
}
dist+=(2*distmrk);
ang1-=1*o;
ang2+=1.5*o;
pos1x = GetCenterX + (dist*cos(ang1));
pos1y = GetCenterY -60 + (dist*sin(ang1));
pos2x = GetCenterX + (50*cos(ang2));
pos2y = GetCenterY -60 + (50*sin(ang2));
a = atan2(pos2y-pos1y,pos2x-pos1x) + p;
let colr = colrs[rand_int(0, length(colrs) - 1)];
let off = rand(-5, 5);
if(frame%n==0){
bx = pos2x;
by = pos2y;
CreateLaser01(bx,by,rand(1.5, 2.5),(a-p) + off + frame/2,50*b,10,colr,n + 5);
}
yield;
    }
}//end bezier

}//end script

Massive props for you Drake! Messing around with this provides awesome results even if you don't exactly know what's going on.
« Last Edit: October 22, 2009, 12:04:12 PM by PT8Sceptile »

Solais

  • Developer fairy
  • is working for a game developer now.
Re: I don't even know what this is anymore
« Reply #2 on: October 22, 2009, 06:32:37 PM »
Dammit, guys, I know nothing about how this works, I suck at math and anything, I'm a complete n00b, but experimenting with this code is fun!!

The thing below is utterly, completely impossible, but it looks great! (Yeah only changed a little...)

Code: [Select]
#TouhouDanmakufu
#Title[It's Motherfucking Disco time!]
#Text[FEVER...]
#ScriptVersion[2]

script_enemy_main{
   let frame = 0;

   let colrs = [RED12, GREEN12, BLUE12, PURPLE12, YELLOW12, AQUA12];

    @Initialize{
        SetLife(10000);
      SetScore(1);
      SetMovePosition01(GetCenterX, GetCenterY - 60, 3);

      bezier(GetCenterX, GetCenterY - 80 - 60, GetCenterX, GetCenterY + 80 - 60,90,1,2,1);
      bezier(GetCenterX, GetCenterY - 80 - 60, GetCenterX, GetCenterY + 80 - 60,90,2,2,2);
      bezier(GetCenterX, GetCenterY - 80 - 60, GetCenterX, GetCenterY + 80 - 60,90,3,2,3);
      bezier(GetCenterX, GetCenterY - 80 - 60, GetCenterX, GetCenterY + 80 - 60,90,4,2,4);
      bezier(GetCenterX, GetCenterY - 80 - 60, GetCenterX, GetCenterY + 80 - 60,90,5,2,5);
    }

    @MainLoop{
      SetCollisionA(GetX, GetY, 32);
      SetCollisionB(GetX, GetY, 16);
      frame++;
      yield;
    }
    @DrawLoop{}
    @Finalize{}

    @BackGround{}

task bezier(x1,y1,x2,y2,p,b,n,o){
    let a;
    let pos2x = x2;
    let pos2y = y2;
    let pos1x = x1;
    let pos1y = y1;
    let bx;
    let by;
    let dist = 25;
    let distmrk = 1;
  
   let ang1 = atan2(y1, x1);
   let ang2 = atan2(y2, x2);

    while(frame>=-1){
      if(dist<=150 && distmrk==1){
         distmrk=1;
      }else if(dist>150 && distmrk==1){
         distmrk=-1;
      }else if(dist<=150 && distmrk==-1){
         distmrk=-1;
      }else if(dist<=0 && distmrk==-1){
         distmrk=1;
      }
      dist+=(2*distmrk);
      ang1-=1*o;
      ang2+=1.5*o;
      pos1x = GetCenterX + (dist*cos(ang1));
      pos1y = GetCenterY -60 + (dist*sin(ang1));
      pos2x = GetCenterX + (50*cos(ang2));
      pos2y = GetCenterY -60 + (50*sin(ang2));
      a = atan2(pos2y-pos1y,pos2x-pos1x) + p;
      let colr = colrs[rand_int(0, length(colrs) - 1)];
      let off = rand(-5, 5);
      if(frame%n==0){
         bx = pos2x;
         by = pos2y;
         CreateLaserA(1,bx,by,50*b,10,colr,n+5);
         SetLaserDataA(1, 0, (a-p), 0, 50*b, rand(1.5, 2.5), (a-p) + off + frame/2);
         SetShotKillTime(1,120);
         FireShot(1);
        
      }
      yield;
    }
}//end bezier

}//end script

EDIT: Holy Shit it freezes at the end! At least not at the start like when I've used curving lasers what moves like the snakes in that spellcard of Nue.
« Last Edit: October 22, 2009, 06:39:55 PM by Solais »

Re: I don't even know what this is anymore
« Reply #3 on: October 22, 2009, 08:42:47 PM »
Oh man that Disco one is awesome. :V

Henry

  • The observer
  • Exploring to the new world of Danmaku
Re: I don't even know what this is anymore
« Reply #4 on: October 23, 2009, 08:59:09 AM »
This looks a lot like danmaku: (and a nice ghostly tail)

Code: [Select]
#TouhouDanmakufu
#Title[what is this]
#Text[i don't even know what is this]
#ScriptVersion[2]

script_enemy_main{
let frame = 0;

let ang1 = 90;
let ang2 = 270;
let pos1x = GetCenterX + (100*cos(ang1));
let pos1y = GetCenterY + (100*sin(ang1));
let pos2x = GetCenterX + (-50*cos(ang2));
let pos2y = GetCenterY + (-50*sin(ang2));

    @Initialize{
        SetLife(10000);
SetScore(1);
bezier(pos1x,pos1y,pos2x,pos2y,10,3,2);
    }

    @MainLoop{
yield;
    }
    @DrawLoop{}
    @Finalize{}

    @BackGround{}

task bezier(x1,y1,x2,y2,p,b,n){
    let a;
    let pos2x = x2;
    let pos2y = y2;
    let pos1x = x1;
    let pos1y = y1;
    let bx;
    let by;
    let dist = 100;
    let distmrk = 1;

    while(frame>=-1){
if(dist<=150 && distmrk==2){
    distmrk=2;
}else if(dist>150 && distmrk==2){
    distmrk=-2;
}else if(dist<=150 && distmrk==-2){
    distmrk=-2;
}else if(dist<=0 && distmrk==-2){
    distmrk=2;
}
dist+=(2*distmrk);
ang1-=2.3;
ang2+=3.7;
pos1x = GetCenterX + (dist*cos(ang1));
pos1y = GetCenterY + (dist*sin(ang1));
pos2x = GetCenterX + (100*cos(ang2));
pos2y = GetCenterY + (100*sin(ang2));
a = atan2(pos2y-pos1y,pos2x-pos1x) + p;
if(frame%n==0){
    ascent(i in (b*-1)..b){
bx = pos2x + (i*3*cos(a));
by = pos2y + (i*3*sin(a));
ascent(j in 0..2){
   CreateShot01(GetCenterX+(-1)^j*(GetCenterX-bx),GetCenterX+(-1)^j*(GetCenterX-by),3,(a-p)+j*180,RED12,2*n+6*b-i*6);
}
    }
}
    frame++;
    yield;
    }
}//end bezier

}//end script
Old/Forgotten member.

Old Patchouli Project was outdated but new one is in progress.

Solais

  • Developer fairy
  • is working for a game developer now.
Re: I don't even know what this is anymore
« Reply #5 on: October 23, 2009, 04:11:29 PM »
This looks a lot like danmaku: (and a nice ghostly tail)

This would be a good Youmu card, with the representation of Myon and all.

Cabble

  • Ask me about my Cat.
  • Not unwilling to shank you.
Re: I don't even know what this is anymore
« Reply #6 on: October 24, 2009, 03:13:09 AM »
Code: [Select]
#TouhouDanmakufu
#Title[what is this]
#Text[i don't even know what is this]
#ScriptVersion[2]

script_enemy_main{
   let frame = 0;

   let ang1 = 90;
   let ang2 = 270;
   let pos1x = GetCenterX + (40*cos(ang1/2));
   let pos1y = GetCenterY + (40*sin(ang1/2));
   let pos2x = GetCenterX + (-10*cos(ang2/2));
   let pos2y = GetCenterY + (-10*sin(ang2/2));

    @Initialize{
        SetLife(10000);
   SetScore(1);
   bezier(pos1x,pos1y,pos2x,pos2y,100,0.5,3);
    }

    @MainLoop{
   yield;
    }
    @DrawLoop{}
    @Finalize{}

    @BackGround{}

task bezier(x1,y1,x2,y2,p,b,n){
    let a;
    let pos2x = x2;
    let pos2y = y2;
    let pos1x = x1;
    let pos1y = y1;
    let bx;
    let by;
    let dist = 100;
    let distmrk = 1;

    while(frame>=-1){
   if(dist<=150 && distmrk==2){
       distmrk=2;
   }else if(dist>150 && distmrk==2){
       distmrk=-2;
   }else if(dist<=150 && distmrk==-2){
       distmrk=-2;
   }else if(dist<=0 && distmrk==-2){
       distmrk=2;
   }
   dist+=(2*distmrk);
   ang1-=100.8;
   ang2+=100.3;
   pos1x = GetCenterX + (dist*cos(ang1));
   pos1y = GetCenterY + (dist*sin(ang1));
   pos2x = GetCenterX + (100*cos(ang2));
   pos2y = GetCenterY + (100*sin(ang2));
   a = atan2(pos2y-pos1y,pos2x-pos1x) + p;
   if(frame%n==0){
       ascent(i in (b*-1)..b){
      bx = pos2x + (i*3*cos(a));
      by = pos2y + (i*3*sin(a));
      ascent(j in 0..2){
         CreateShot01(GetCenterX+(-1)^j*(GetCenterX-bx*2+180),GetCenterX+(-1)^j*(GetCenterX-by*2+180),0.3,(a-p*60/3)+j*180/6*270,RED12,2*n+6*b-i*6);
      }
       }
   }
       frame++;
       yield;
    }
}//end bezier

}//end script
I had a teacher who used to play radiohead during class once.

ONCE.

PT8Sceptile

  • All hail Giant Catfish!
Re: I don't even know what this is anymore
« Reply #7 on: October 24, 2009, 08:24:37 PM »
After tweaking around with my first script a bit, I came up with this:

Code: [Select]
#TouhouDanmakufu
#Title[Virtue of Bezier Curve]
#Text[AAAAAAAAAAAAAAAAAA!!!!!]
#BackGround[Default]
#PlayLevel[Probably Hard] 
#ScriptVersion[2]

script_enemy_main{
let frame = -120;
let red = 0;
let dir = 1;

    @Initialize{
        SetLife(8000);
SetScore(100000);
SetMovePosition01(GetCenterX, GetCenterY - 60, 3);
SetInvincibility(300);

CutIn(YOUMU, ""\""Virtue of Bezier Curve"\", 0, 0, 0, 0, 0);
    }

    @MainLoop{
SetCollisionA(GetX, GetY, 32);
SetCollisionB(GetX, GetY, 16);
frame++;
let off = rand(0, 360);
if (frame == 0) {
bezier(GetCenterX + 20, GetCenterY - 100, GetCenterX - 40, GetCenterY - 100,85,4,2,0 + off,RED12);
bezier(GetCenterX + 20, GetCenterY - 100, GetCenterX - 40, GetCenterY - 100,85,4,2,180 + off,GREEN12);
bezier(GetCenterX + 20, GetCenterY - 100, GetCenterX - 40, GetCenterY - 100,85,4,2,90 + off,BLUE12);
bezier(GetCenterX + 20, GetCenterY - 100, GetCenterX - 40, GetCenterY - 100,85,4,2,270 + off,PURPLE12);
bezier(GetCenterX + 20, GetCenterY - 100, GetCenterX - 40, GetCenterY - 100,85,4,2,45 + off,YELLOW12);
bezier(GetCenterX + 20, GetCenterY - 100, GetCenterX - 40, GetCenterY - 100,85,4,2,135 + off,AQUA12);
bezier(GetCenterX + 20, GetCenterY - 100, GetCenterX - 40, GetCenterY - 100,85,4,2,225 + off,ORANGE12);
bezier(GetCenterX + 20, GetCenterY - 100, GetCenterX - 40, GetCenterY - 100,85,4,2,315 + off,WHITE12);
}
if (frame == 140 - red) {
frame = -1;
if (red < 60) {
red += 4;
}
dir *= -1;
}
yield;
    }
    @DrawLoop{}
    @Finalize{}

    @BackGround{}

task bezier(x1,y1,x2,y2,p,b,n,o,clr){
    let a;
    let pos2x = x2;
    let pos2y = y2;
    let pos1x = x1;
    let pos1y = y1;
    let bx;
    let by;
    let dist = 25;
    let distmrk = 1;

let ang1 = atan2(y1, x1) + o;
let ang2 = atan2(y2, x2) + o;

let count = 0;

    while(count<=50){
if(dist<=150 && distmrk==1){
distmrk=1;
}else if(dist>150 && distmrk==1){
distmrk=-1;
}else if(dist<=150 && distmrk==-1){
distmrk=-1;
}else if(dist<=0 && distmrk==-1){
distmrk=1;
}
dist+=(2*distmrk);
ang1-=5*dir;
ang2+=7.5*dir;
pos1x = GetCenterX + (dist*cos(ang1));
pos1y = GetCenterY -100 + (dist*sin(ang1));
pos2x = GetCenterX + (50*cos(ang2));
pos2y = GetCenterY -100 + (50*sin(ang2));
a = atan2(pos2y-pos1y,pos2x-pos1x) + p;
let offang = rand(-17, 17);
let offvel = rand(2.5,3.5);
if(frame%n==0){
ascent(i in (b*-1)..b){
bx = pos2x + (i*3*cos(a));
by = pos2y + (i*3*sin(a));
CreateShotA(1,bx,by,n+5);
SetShotDataA(1,0,3,(a-p),0,-0.05,0,clr);
SetShotDataA(1,90 - count/2,0,(a-p) + offang,0,0.08,offvel,clr);
FireShot(1);
}
}
count++;
yield;
    }
}//end bezier

}//end script

Yeah, Kanako wants her spell back.

Drake

  • *
Re: I don't even know what this is anymore
« Reply #8 on: October 24, 2009, 09:31:29 PM »
That one's nice. I like it. Only problem is that the randomness throws you walls. You can still have randomness and a wall-less pattern coexist, you know.

A Colorful Calculating Creative and Cuddly Crafty Callipygous Clever Commander
- original art by Aiけん | ウサホリ -

Re: I don't even know what this is anymore
« Reply #9 on: October 24, 2009, 09:46:23 PM »
After tweaking around with my first script a bit, I came up with this:

Code: [Select]
#TouhouDanmakufu
#Title[Virtue of Bezier Curve]
#Text[AAAAAAAAAAAAAAAAAA!!!!!]
#BackGround[Default]
#PlayLevel[Probably Hard] 
#ScriptVersion[2]

script_enemy_main{
let frame = -120;
let red = 0;
let dir = 1;

    @Initialize{
        SetLife(8000);
SetScore(100000);
SetMovePosition01(GetCenterX, GetCenterY - 60, 3);
SetInvincibility(300);

CutIn(YOUMU, ""\""Virtue of Bezier Curve"\", 0, 0, 0, 0, 0);
    }

    @MainLoop{
SetCollisionA(GetX, GetY, 32);
SetCollisionB(GetX, GetY, 16);
frame++;
let off = rand(0, 360);
if (frame == 0) {
bezier(GetCenterX + 20, GetCenterY - 100, GetCenterX - 40, GetCenterY - 100,85,4,2,0 + off,RED12);
bezier(GetCenterX + 20, GetCenterY - 100, GetCenterX - 40, GetCenterY - 100,85,4,2,180 + off,GREEN12);
bezier(GetCenterX + 20, GetCenterY - 100, GetCenterX - 40, GetCenterY - 100,85,4,2,90 + off,BLUE12);
bezier(GetCenterX + 20, GetCenterY - 100, GetCenterX - 40, GetCenterY - 100,85,4,2,270 + off,PURPLE12);
bezier(GetCenterX + 20, GetCenterY - 100, GetCenterX - 40, GetCenterY - 100,85,4,2,45 + off,YELLOW12);
bezier(GetCenterX + 20, GetCenterY - 100, GetCenterX - 40, GetCenterY - 100,85,4,2,135 + off,AQUA12);
bezier(GetCenterX + 20, GetCenterY - 100, GetCenterX - 40, GetCenterY - 100,85,4,2,225 + off,ORANGE12);
bezier(GetCenterX + 20, GetCenterY - 100, GetCenterX - 40, GetCenterY - 100,85,4,2,315 + off,WHITE12);
}
if (frame == 140 - red) {
frame = -1;
if (red < 60) {
red += 4;
}
dir *= -1;
}
yield;
    }
    @DrawLoop{}
    @Finalize{}

    @BackGround{}

task bezier(x1,y1,x2,y2,p,b,n,o,clr){
    let a;
    let pos2x = x2;
    let pos2y = y2;
    let pos1x = x1;
    let pos1y = y1;
    let bx;
    let by;
    let dist = 25;
    let distmrk = 1;

let ang1 = atan2(y1, x1) + o;
let ang2 = atan2(y2, x2) + o;

let count = 0;

    while(count<=50){
if(dist<=150 && distmrk==1){
distmrk=1;
}else if(dist>150 && distmrk==1){
distmrk=-1;
}else if(dist<=150 && distmrk==-1){
distmrk=-1;
}else if(dist<=0 && distmrk==-1){
distmrk=1;
}
dist+=(2*distmrk);
ang1-=5*dir;
ang2+=7.5*dir;
pos1x = GetCenterX + (dist*cos(ang1));
pos1y = GetCenterY -100 + (dist*sin(ang1));
pos2x = GetCenterX + (50*cos(ang2));
pos2y = GetCenterY -100 + (50*sin(ang2));
a = atan2(pos2y-pos1y,pos2x-pos1x) + p;
let offang = rand(-17, 17);
let offvel = rand(2.5,3.5);
if(frame%n==0){
ascent(i in (b*-1)..b){
bx = pos2x + (i*3*cos(a));
by = pos2y + (i*3*sin(a));
CreateShotA(1,bx,by,n+5);
SetShotDataA(1,0,3,(a-p),0,-0.05,0,clr);
SetShotDataA(1,90 - count/2,0,(a-p) + offang,0,0.08,offvel,clr);
FireShot(1);
}
}
count++;
yield;
    }
}//end bezier

}//end script

Yeah, Kanako wants her spell back.
This one starts to slow down after a while...

Drake

  • *
Re: I don't even know what this is anymore
« Reply #10 on: October 24, 2009, 09:55:19 PM »
That's because he mixed the task into his MainLoop. Now instead of just the script happening every frame and keeping the same variables set in Initialize, he's creating new ones each time the task is called. Which is bad.

A Colorful Calculating Creative and Cuddly Crafty Callipygous Clever Commander
- original art by Aiけん | ウサホリ -


PT8Sceptile

  • All hail Giant Catfish!
Re: I don't even know what this is anymore
« Reply #12 on: October 25, 2009, 07:08:23 AM »
That's because he mixed the task into his MainLoop. Now instead of just the script happening every frame and keeping the same variables set in Initialize, he's creating new ones each time the task is called. Which is bad.

Wait, so THAT's what caused the massive slowdown...

Yippee... All this time I've been thinking that the variables a task stores stop hogging the system's resources once the task finishes executing. Major thanks for correcting this huge misassumption. Now I know to be more careful with variable declaration in tasks.

Anyways, fixed version (tasks are still in MainLoop, but are called only once during the entire script).

Code: [Select]
#TouhouDanmakufu
#Title[Virtue of Bezier Curve]
#Text[AAAAAAAAAAAAAAAAAA!!!!!]
#BackGround[Default]
#PlayLevel[Probably Hard] 
#ScriptVersion[2]

script_enemy_main{
let frame = -120;
let red = 0;
let dir = 1;

let offan = rand(0, 360);

    @Initialize{
        SetLife(8000);
SetScore(100000);
SetMovePosition01(GetCenterX, GetCenterY - 60, 3);
SetInvincibility(300);

CutIn(YOUMU, ""\""Virtue of Bezier Curve"\", 0, 0, 0, 0, 0);
    }

    @MainLoop{
SetCollisionA(GetX, GetY, 32);
SetCollisionB(GetX, GetY, 16);
frame++;
if (frame == 0) {
bezier(GetCenterX + 20, GetCenterY - 100, GetCenterX - 40, GetCenterY - 100,85,4,2,0 ,RED12);
bezier(GetCenterX + 20, GetCenterY - 100, GetCenterX - 40, GetCenterY - 100,85,4,2,180,GREEN12);
bezier(GetCenterX + 20, GetCenterY - 100, GetCenterX - 40, GetCenterY - 100,85,4,2,90,BLUE12);
bezier(GetCenterX + 20, GetCenterY - 100, GetCenterX - 40, GetCenterY - 100,85,4,2,270,PURPLE12);
bezier(GetCenterX + 20, GetCenterY - 100, GetCenterX - 40, GetCenterY - 100,85,4,2,45,YELLOW12);
bezier(GetCenterX + 20, GetCenterY - 100, GetCenterX - 40, GetCenterY - 100,85,4,2,135,AQUA12);
bezier(GetCenterX + 20, GetCenterY - 100, GetCenterX - 40, GetCenterY - 100,85,4,2,225,ORANGE12);
bezier(GetCenterX + 20, GetCenterY - 100, GetCenterX - 40, GetCenterY - 100,85,4,2,315,WHITE12);
}
if (frame == 140 - red) {
frame = 0;
if (red < 60) {
red += 4;
}
dir *= -1;
offan = rand(0, 360);
}
yield;
    }
    @DrawLoop{}
    @Finalize{}

    @BackGround{}

task bezier(x1,y1,x2,y2,p,b,n,o,clr){
    let a;
    let pos2x = x2;
    let pos2y = y2;
    let pos1x = x1;
    let pos1y = y1;
    let bx;
    let by;
    let dist = 25;
    let distmrk = 1;

let ang1 = atan2(y1, x1) + o + offan;
let ang2 = atan2(y2, x2) + o + offan;

    while(frame >= 0){
if(dist<=150 && distmrk==1){
distmrk=1;
}else if(dist>150 && distmrk==1){
distmrk=-1;
}else if(dist<=150 && distmrk==-1){
distmrk=-1;
}else if(dist<=0 && distmrk==-1){
distmrk=1;
}
if (frame == 0) {
dist = 25;
distmrk = 1;
ang1 = atan2(y1, x1) + o + offan;
ang2 = atan2(y2, x2) + o + offan;
}
dist+=(2*distmrk);
ang1-=10*dir;
ang2+=15*dir;
pos1x = GetCenterX + (dist*cos(ang1));
pos1y = GetCenterY -100 + (dist*sin(ang1));
pos2x = GetCenterX + (50*cos(ang2));
pos2y = GetCenterY -100 + (50*sin(ang2));
a = atan2(pos2y-pos1y,pos2x-pos1x) + p;
if(frame%n==0 && frame <= 50){
ascent(i in (b*-1)..b){
bx = pos2x + (i*3*cos(a));
by = pos2y + (i*3*sin(a));
CreateShotA(1,bx,by,n+5);
SetShotDataA(1,0,3,(a-p),0,-0.05,0,clr);
SetShotDataA(1,90 - frame/2,0,(a-p),0,0.08,3,clr);
FireShot(1);
}
}
yield;
    }
}//end bezier

}//end script

EDIT: Removed the wall-inducing randomness as Drake pointed out. I needed to change the looks of the circle a bit since otherwise it would have been ridiculously easy. Now the difficulty is about the same, but the pattern is somewhat static as the initial flower's angle is the only random variable. This should prevent random walls from blocking the only ways through.
« Last Edit: October 25, 2009, 07:21:28 AM by PT8Sceptile »

Drake

  • *
Re: I don't even know what this is anymore
« Reply #13 on: October 25, 2009, 06:48:30 PM »
Almost, but not quite. You did get rid of the randomness though, which is good.

Code: [Select]
#TouhouDanmakufu
#Title[Virtue of Bezier Curve]
#Text[AAAAAAAAAAAAAAAAAA!!!!!]
#BackGround[Default]
#PlayLevel[Probably Hard]
#ScriptVersion[2]

script_enemy_main{
   let frame = -120;
   let red = 0;
   let dir = 1;
   let csd = GetCurrentScriptDirectory;
   let offan = rand(0, 360);

    @Initialize{
      LoadUserShotData(csd~"supershot.dnh");
      SetLife(8000);
      SetScore(100000);
      SetMovePosition01(GetCenterX, GetCenterY - 60, 3);
      SetInvincibility(300);
     
      CutIn(YOUMU, ""\""Virtue of Bezier Curve"\", 0, 0, 0, 0, 0);
      do8;
    }

    @MainLoop{
      SetCollisionA(GetX, GetY, 32);
      SetCollisionB(GetX, GetY, 16);
      yield;
    }
    @DrawLoop{}
    @Finalize{}

    @BackGround{}

task do8{
  while(IsBossExisting){
    frame++;

    if(frame==0){
        bezier(GetCenterX + 20, GetCenterY - 100, GetCenterX - 40, GetCenterY - 100,85,2,2,0 ,96);
        bezier(GetCenterX + 20, GetCenterY - 100, GetCenterX - 40, GetCenterY - 100,85,2,2,180,104);
        bezier(GetCenterX + 20, GetCenterY - 100, GetCenterX - 40, GetCenterY - 100,85,2,2,90,99);
        bezier(GetCenterX + 20, GetCenterY - 100, GetCenterX - 40, GetCenterY - 100,85,2,2,270,97);
        bezier(GetCenterX + 20, GetCenterY - 100, GetCenterX - 40, GetCenterY - 100,85,2,2,45,106);
        bezier(GetCenterX + 20, GetCenterY - 100, GetCenterX - 40, GetCenterY - 100,85,2,2,135,101);
        bezier(GetCenterX + 20, GetCenterY - 100, GetCenterX - 40, GetCenterY - 100,85,2,2,225,107);
        bezier(GetCenterX + 20, GetCenterY - 100, GetCenterX - 40, GetCenterY - 100,85,2,2,315,95);
    }
    if(frame==140-red){
frame=0;
if (red < 60) {
    red += 4;
}

dir*=-1;
offan = rand(0, 360);
    }
    yield;
  }
}

task bezier(x1,y1,x2,y2,p,b,n,o,clr){
    let a;
    let pos2x = x2;
    let pos2y = y2;
    let pos1x = x1;
    let pos1y = y1;
    let bx;
    let by;
    let dist = 25;
    let distmrk = 1;
   
   let ang1 = atan2(y1, x1) + o + offan;
   let ang2 = atan2(y2, x2) + o + offan;

    while(frame >= 0){
      if(dist<=150 && distmrk==1){
         distmrk=1;
      }else if(dist>150 && distmrk==1){
         distmrk=-1;
      }else if(dist<=150 && distmrk==-1){
         distmrk=-1;
      }else if(dist<=0 && distmrk==-1){
         distmrk=1;
      }
      if (frame == 0) {
         dist = 25;
         distmrk = 1;
         ang1 = atan2(y1, x1) + o + offan;
         ang2 = atan2(y2, x2) + o + offan;
      }
      dist+=(2*distmrk);
      ang1-=10*dir;
      ang2+=15*dir;
      pos1x = GetCenterX + (dist*cos(ang1));
      pos1y = GetCenterY -100 + (dist*sin(ang1));
      pos2x = GetCenterX + (50*cos(ang2));
      pos2y = GetCenterY -100 + (50*sin(ang2));
      a = atan2(pos2y-pos1y,pos2x-pos1x) + p;
      if(frame%n==0 && frame <= 50){
         ascent(i in (b*-1)..b){
         bx = pos2x + (i*5*cos(a));
         by = pos2y + (i*5*sin(a));
         CreateShotA(1,bx,by,n+5);
         SetShotDataA(1,0,3,(a-p),0,-0.05,0,clr);
         SetShotDataA(1,90 - frame/2,0,(a-p),0,0.05,3,clr);
         FireShot(1);
         }
      }
      yield;
    }
}//end bezier

}//end script
I switched to amulet bullets, changed around b and how far they're spaced from each other, but don't worry about that.

A Colorful Calculating Creative and Cuddly Crafty Callipygous Clever Commander
- original art by Aiけん | ウサホリ -