Author Topic: Another Danmakufu Tutorial?  (Read 48791 times)

kdillon7323

Re: Another Danmakufu Tutorial?
« Reply #30 on: April 26, 2009, 12:50:08 AM »
Ok thank you I now understand and that helps a lot.

Garlyle

  • I can't brain today
  • I have the dumb
    • Tormod Plays Games
Re: Another Danmakufu Tutorial?
« Reply #31 on: April 27, 2009, 02:57:35 PM »
Quote
Just don't forget to insert a yield command in your MainLoop, or the bullet won't bounce.
This should be in big bold letters.

Also

while(!Obj_BeDeleted){} is just a short form of "while Obj_BeDeleted==false" .  ! means 'not' in programming terms.  For instance, if(bullets != 30){} would activate when 'bullets' was -not- equal to 30.  When checking for boolean values, like Obj_BeDeleted, you don't even need the == if it's searching for true.  The ! beforehand means "when NOT".

So yeah.  They're the same thing, just !Obj_BeDeleted is a bit quicker.


(Also, I may take the time to write up a tutorial on stages/events, so...)

Iryan

  • Ph?nglui mglw?nafh
  • Cat R?lyeh wgah?nagl fhtagn.
Re: Another Danmakufu Tutorial?
« Reply #32 on: April 27, 2009, 05:22:53 PM »
Sooo... I said I wanted to show how to replicate AyaSatori's 3rd spellcard, "Great Whirlwind". It was actually really easy, the typing of this post will probably take much longer. :V


How to use object bullets part 2: "Great Whirlwind"



So, you are familiar with this spellcard and maybe even captured it. But how does it work?
Well, each seperate cyclone is a cluster of several bullets with the same starting point and angular velocity, but with different starting angles and speeds. The same angular velocity ensures that every bullet of the cluster will return to the center at the same time, then the cluster will unfold again, dependent on the different angles and speeds of the individual bullets.
So far, this would be easy to replicate with a CreateShotA, right? There is a little problem, however: the cyclones move downward, and still, they manage to stick to their circling motion. That is quite tougher to program.

There are actually two ways to do this; one involves CreateShotA_XY and trigonometric functions, the other involves object bullets, but since I'm here to showcase how to have fun with object bullets, we'll use these.

Let's start out with the basic framework from the previous post, with a different bullet sprite:
Code: [Select]
task Bullet(x, y, v, angle) {
      let obj=Obj_Create(OBJ_SHOT);

      Obj_SetPosition(obj, x, y);
      Obj_SetAngle(obj, angle);
      Obj_SetSpeed(obj, v);
      ObjShot_SetGraphic(obj, BLUE21);
      ObjShot_SetDelay  (obj, 0);
      ObjShot_SetBombResist (obj, true);

      while(Obj_BeDeleted(obj)==false) {
              yield;
       }
We said that the bullets have an angular velocity, so we'll work in a command that adjusts the angle of the bullet by a fixed amount every frame:
Code: [Select]
      Obj_SetAngle(obj, Obj_GetAngle(obj) + 2);
Now we can create an object bullet that will move in a circle. Firing a ring of these bullets will get you a pulsating circle with a radius of
360*(velocity of the bullets) / (2*Pi).
Using an angular veloctiy of 2 means that the bullet will have moved a full circle after 360/2 frames. That is exactly three seconds after being fired.

The bullets still won't move downwards, though. To accomplish that, we have to add a command that moves the bullet downward every frame, independently from the regular movement direction and speed. To simulate this movement, we can simply set the position of the bullet to a place the has a distance of, say, one pixel, every frame. A command that does this looks like this:
Code: [Select]
      Obj_SetPosition(Obj_GetX(obj), Obj_GetY(obj) + 1);
The bullet is moved straight down by one pixel every frame. Of course, if we wanted, we could make the whole cyclone move in a specific pattern itself, like waving to left and right while moving to the bottom of the screen ~~~~ , adjusting the x coordinate every second dependent on the value of a trigonometric function. You can do that as practice, if you like.  ;D

So, inserting both of these commands into the bullet task, we get:

Code: [Select]
task Bullet(x, y, v, angle) {
      let obj=Obj_Create(OBJ_SHOT);

      Obj_SetPosition(obj, x, y);
      Obj_SetAngle(obj, angle);
      Obj_SetSpeed(obj, v);
      ObjShot_SetGraphic(obj, BLUE21);
      ObjShot_SetDelay  (obj, 0);
      ObjShot_SetBombResist (obj, true);

      while(Obj_BeDeleted(obj)==false) {
              Obj_SetAngle(obj, Obj_GetAngle(obj) + 2);
              Obj_SetPosition(Obj_GetX(obj), Obj_GetY(obj) + 1);
              yield;
       }

This task creates a single bullet that spirals down the screen. To craft a cyclone, you have to fire a ring of these bullets. Several rings with different bullet speeds, actually. For this, we can define a function:

Code: [Select]
function cyclone(x, y){
        ascent(i in 0..10){
        ascent(k in 0..6){
                Bullet(x, y, 0.5*(1+k), i*40);
        }    }
This will fire 6 rings of 9 stormbullets each. The rings have an individual bullet speed of 0.5, 1, 1.5,  2, 2.5 and 3, and thus different radii. Calling This function for a specified place will call down a whirlwind that folds and unfolds indefinitely as it carves it's way to the bottom of the screen.

Now, to emulate the spellcard, define the task after @finalize, define the function in the mainscript and then call the function with your main loop in regular intervals.
Again, do not forget the yield; in the MainLoop!
« Last Edit: April 27, 2009, 05:59:47 PM by Iryan »
Old Danmakufu stuff can be found here!

"As the size of an explosion increases, the numbers of social situations it is incapable of solving approaches zero."

Hat

  • Just an unassuming chapeau.
  • I will never be ready.
Re: Another Danmakufu Tutorial?
« Reply #33 on: April 27, 2009, 11:46:15 PM »
Wow, Iryan, you're really good at this object bullet business. I was actually meaning to figure this one out independently, but thanks anyway!

kdillon7323

Re: Another Danmakufu Tutorial?
« Reply #34 on: April 28, 2009, 05:57:55 PM »
could I ask how after Kurodani Yamames first spell card how to make the bullets kinda spin around her while shooting? I dont care about them turning red and then slowing down just the spinning part.

Iryan

  • Ph?nglui mglw?nafh
  • Cat R?lyeh wgah?nagl fhtagn.
Re: Another Danmakufu Tutorial?
« Reply #35 on: April 28, 2009, 07:43:42 PM »
You mean spiraling bullets?

That is actually the second most commmon way to create a pattern of danmaku, after the bulletrings.

To do that, you just have to fire a bullet each frame with any CreateShot, the direction of which is determined by a variable. Then have this variable increase by a set amount every frame, and looky there - a spiral of bullets.

Yamame's 2nd nonspellcard has several of these spirals that are divided evenly among 360 degrees. Just fire, let's say 4 bullets, one at an angle of (0+variable), one at an angle of (90+variable), one at an angle of (180+variable) and one at an angle of (270+variable).

There you go.  8)
Old Danmakufu stuff can be found here!

"As the size of an explosion increases, the numbers of social situations it is incapable of solving approaches zero."

kdillon7323

Re: Another Danmakufu Tutorial?
« Reply #36 on: April 28, 2009, 08:04:39 PM »
Ok I can get one to spiral.
But when I try to get 2 to spiral in opposite directions I have trouble

if(frame==10){
CreateShot01(GetX, GetY, 2, angle, RED21, 0);
angle += 17;
CreateShot01(GetX, GetY, 2, angle, BLUE21, 0);
angle -= 17;
frame = 0;}
frame++

frame and angle are both 0.
The red looks like its shooting at 0 degrees and the blue looks like its shooting at about 20.
How do I fix this?

Garlyle

  • I can't brain today
  • I have the dumb
    • Tormod Plays Games
Re: Another Danmakufu Tutorial?
« Reply #37 on: April 28, 2009, 08:46:12 PM »
Use different variables.

Your angle commands are cancelling each other out.  It's going...

"Fire RED at angle (0)
Increase angle by 17 (now 17)
Fire BLUE at angle (17)
Decrease angle by 17 (now 0)"

You could try having two variables, like so:

CreateShot01(GetX, GetY, 2, angleA, RED21, 0);
angleA += 17;
CreateShot01(GetX, GetY, 2, angleB, BLUE21, 0);
angleB -= 17;

Alternatively, if you don't want to use different variables, try the following:

CreateShot01(GetX, GetY, 2, angle, RED21, 0);
CreateShot01(GetX, GetY, 2, 0-angle, BLUE21, 0);
angle += 17;

This will basically make the two go in opposite directions.  Different methods of doing this make different results, of course.

Iryan

  • Ph?nglui mglw?nafh
  • Cat R?lyeh wgah?nagl fhtagn.
Re: Another Danmakufu Tutorial?
« Reply #38 on: April 28, 2009, 08:51:15 PM »
Well, of course.

Read your code again and think about what it does. It fires one bullet at an angle of "angle", which starts 0, then increases "angle" by 17, then fires a bullet at "angle", which is 17 (and thus basically is "about 20"), then changes "angle" back to 0. Next loop, it starts again the same way.

You have two options. Either you make two different variables for the different spirals' angles, or you make the second bullet be fired at an angle of (-"angle").


I advise you to closely examine your code yourself everytime something is not working at fixing it yourself. That way, you'll gain a better understanding of what happens why, and what doesn't happen why: it makes you a better programmer.  ;)


?dit: Darn, lunardial'd!
Old Danmakufu stuff can be found here!

"As the size of an explosion increases, the numbers of social situations it is incapable of solving approaches zero."

kdillon7323

Re: Another Danmakufu Tutorial?
« Reply #39 on: April 28, 2009, 09:13:47 PM »
I should have thought of the two different variable part lol.
But I got it to work.
Ok another question...(apoligizing for a whole lot of questions.)


I have this
if(frame==5){
CreateShot01(GetX, GetY, 2, angle, RED01, 1);
angle+=3;
CreateShot01(GetX, GetY, 2, angle+180, BLUE01, 1);
angle+=3;
frame = 0;}
frame++

So the bullets are spiraling firing every 5 frames.
But say I want to fire a ring of bullets every 60 frames...
but the frame never gets past 3... How do I get THAT to work?

Hat

  • Just an unassuming chapeau.
  • I will never be ready.
Re: Another Danmakufu Tutorial?
« Reply #40 on: April 28, 2009, 10:05:28 PM »
Either use another variable for the framecount, OR in this particular instance you could say instead of
Code: [Select]
if(frame==5){
CreateShot01(GetX, GetY, 2, angle, RED01, 1);
angle+=3;
CreateShot01(GetX, GetY, 2, angle+180, BLUE01, 1);
angle+=3;
frame = 0;}
frame++
You could have,
Code: [Select]
if(frame%5 == 0){
CreateShot01(GetX, GetY, 2, angle, RED01, 1);
angle+=3;
CreateShot01(GetX, GetY, 2, angle+180, BLUE01, 1);
angle+=3;
frame = 0;}
if(frame%60 == 0){
Some Bullets Hizurr
frame = 0;
}
frame++
Something like that. The modulus % means, basically... if you were to divide it by the number indicated after the %, the remainder is given. So every five frames, the remainder will be zero... and you can count up that way. Once the modulus for 60 is passed, it'll set it back to 0 and you start the whole process over again.

kdillon7323

Re: Another Danmakufu Tutorial?
« Reply #41 on: April 28, 2009, 10:30:33 PM »
OK thank you I got it to work with the % modulus but I deleted "frame = 0" after the 2nd CreateShot01.

Hat

  • Just an unassuming chapeau.
  • I will never be ready.
Re: Another Danmakufu Tutorial?
« Reply #42 on: April 28, 2009, 10:35:14 PM »
AH, yes, I knew I was forgetting something. XD Derp derp.

Re: Another Danmakufu Tutorial?
« Reply #43 on: May 13, 2009, 04:26:27 AM »
What does SetMovePositionHermite(); do, what are it's parameters, how does it work, and is it even worth my time including it in the Boss Movement section of this intermediate tutorial? I know it's explained in the Japanese tutorial with a diagram and pretty arrows, which seem to yield a lovely curved movement trajectory... But man, everytime I go to the Engrish Danmakufu wiki for a synopsis of what's going on I just rage furiously at that fucking useless explanation! Blaarargsbhfghh!

Iryan

  • Ph?nglui mglw?nafh
  • Cat R?lyeh wgah?nagl fhtagn.
Re: Another Danmakufu Tutorial?
« Reply #44 on: May 13, 2009, 10:13:05 AM »
The way I understand it from the wiki, it goes as follows:

The boss starts to move from his position. The motion starts in a specified direction d1 with a specified speed v1.
The boss moves towards the specified position, that is, ( x | y ). At the moment when he arrives, his movement has a certain angle d2 and he moves at a speed of v2.

The entire motion in between will be calculated as a curve so that the initial movement angle and the movement angle at the arrival are as specified. Ditto for initial and final speed. The speed in general will be adjusted so that initial and final speed are as specified and the total durance of the movement is the specified time t.

Thus, if I understand it correctly, the parameters would be in order: (x, y, v1, d1, v2, d2, t)

Sounds like it would eat on your processor in a similar way as the curving lasers...

I'd test it, but I'm not in the mood to restart my PC right now...
Old Danmakufu stuff can be found here!

"As the size of an explosion increases, the numbers of social situations it is incapable of solving approaches zero."

CK Crash

  • boozer
Re: Another Danmakufu Tutorial?
« Reply #45 on: May 13, 2009, 09:13:21 PM »
How would I go about actually making a spellcard background? I also need it to fade in as the spellcard starts, since I plan on making it part of a plural script.

I realize this may be better for the Q/A thread, but this is also something that ought to be covered by the tutorials better.

Garlyle

  • I can't brain today
  • I have the dumb
    • Tormod Plays Games
Re: Another Danmakufu Tutorial?
« Reply #46 on: May 13, 2009, 10:37:04 PM »
Include an @Background section on the Spellcard.  Each individual Spellcard will utilize the background you specify within instead of the default, if you have included it.

Stuffman

  • *
  • We're having a ball!
Re: Another Danmakufu Tutorial?
« Reply #47 on: May 13, 2009, 11:05:47 PM »
Quote
What does SetMovePositionHermite(); do, what are it's parameters, how does it work, and is it even worth my time including it in the Boss Movement section of this intermediate tutorial?

Ilyan's explanation is mostly right but not quite.

Code: [Select]
SetMovePositionHermite(x,y,distance1,angle1,distance2,angle2,frames);
  • x/y: This is the destination point of the boss, obviously.
  • distance1: If you were to draw a line between the starting point and destination point, this value is how far the boss moves from that line. I'm not quite sure how this is calculated but as a rule of thumb, three times the length of the line gives you a circular movement arc.
  • angle1: This is the angle you are moving at when you begin the movement.
  • distance2: Same as above but for the second half of the movement.
  • angle2: This is the angle you are moving at when you finish the movement.
  • frames: This is how long it takes to complete the movement. In other words it sets the speed, just like SetMovePosition02.

As a sample from one of my spinner enemies in PoSR:
Code: [Select]
SetMovePositionHermite(GetX()+100,GetY(),300,90,300,270,40);The enemy comes onto the screen straight down and does a 180 to its right. The helmite part of its movement involves moving 100 pixels to the right, starting at 90 degrees (down) and ending at 270 degrees (up). The distance in both cases is 300 (3*100 pixel distance) for a round movement arc. It takes 40 frames to complete this movement.

That should be enough for practical use, but you can get some really wacky movement if you play around with it. It's actually rather easy to use once you understand the arguments. The distance arguments are the only ones I don't fully understand.

And no it doesn't cause any slowdown, the slowdown on C Lasers is because of the complex transparent drawing involved, not the math.

---

Quote
How would I go about actually making a spellcard background? I also need it to fade in as the spellcard starts, since I plan on making it part of a plural script.

I actually don't even bother with @Background, I just draw a screen-size image behind the boss in @DrawLoop. You can even have multiple images with different transparency for layered effects. Just draw it before you draw the boss so the boss is on top of it. For the fade-in just have a SetAlpha with a special count variable or whatever. It works exactly the same way as drawing the boss, just much bigger.

Re: Another Danmakufu Tutorial?
« Reply #48 on: May 13, 2009, 11:20:14 PM »
Why is it that whenever I try to call a task/function/whatever, the name of said function in the MainLoop always comes up as an error?

Take this for example:


Code: [Select]
#TouhouDanmakufu
#Title[Bounce Bullet]
#Text[Test script]
#Player[FREE]
#ScriptVersion[2]

script_enemy_main {
let ImgBoss = "script\thC\IMAGE\CHAR\DOT\boss_remilia.png";

let count = 0;
let a=0;

@Initialize {
SetLife(2500);
SetTimer(60);
SetScore(10000000);

SetEnemyMarker(true);

SetMovePosition02(225, 120, 60);

LoadGraphic(ImgBoss);
SetTexture(ImgBoss);
SetGraphicRect(0, 0, 100, 100);
}

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

if(count == 5) {
Bounce(GetX, GetY, 3, GetAngleToPlayer);

count=0
}
count++;
}

@DrawLoop {
DrawGraphic(GetX, GetY);
}

@Finalize {
DeleteGraphic(ImgBoss);
}
}







task Bounce(x, y, v, angle) {
     let obj=Obj_Create(OBJ_SHOT);

     Obj_SetPosition(obj, x, y);
     Obj_SetAngle(obj, angle);
     Obj_SetSpeed(obj, v);
     ObjShot_SetGraphic(obj, RED01);
     ObjShot_SetDelay(obj, 0);
     ObjShot_SetBombResist(obj, true);

     while(Obj_BeDeleted(obj)==false){

           yield;

}

What am I doing wrong? Why does it keep reading it as an error? I don't get it.

Stuffman

  • *
  • We're having a ball!
Re: Another Danmakufu Tutorial?
« Reply #49 on: May 13, 2009, 11:56:32 PM »
The task needs to be inside script_enemy_main. Put it above @Initialize or something.

Re: Another Danmakufu Tutorial?
« Reply #50 on: May 14, 2009, 12:06:36 AM »
Thank you.

Why does Iryan say put it after finalize?

Re: Another Danmakufu Tutorial?
« Reply #51 on: May 14, 2009, 12:20:04 AM »
It can go anywhere you want, as long as it's inside script_enemy_main{}, but outside any @MainLoop{}, @Finalize, @Initialize, etc. Most people put tasks either before @Initialize (which would mean at the start of the script), or after @Finalize (which would mean at the end of the script). These places are typically where people look for any tasks you've defined, as most of us don't want to sift through the middle of your code for any tasks you've hidden away. It doesn't affect anything except how easy it is for a human to find in your text file, so don't worry about it.

Also, thanks for the explanations on SetMovePositionHermite, I'll be including it in the tutorial.
« Last Edit: May 14, 2009, 12:24:28 AM by Naut »

Stuffman

  • *
  • We're having a ball!
Re: Another Danmakufu Tutorial?
« Reply #52 on: May 14, 2009, 12:29:54 AM »
Useless but interesting: Actually, I think you can put tasks inside things like @Initialize or @MainLoop, but then it'll only work inside of them. It works like declaring variables in that respect.

Re: Another Danmakufu Tutorial?
« Reply #53 on: May 14, 2009, 12:38:35 AM »
Okay.


I have one more question: Does anybody know how to detect object collision with other objects (i.e. say:

Quote
if(object collision == true){
)


Touhou wiki's Collision_Obj_Obj is being read as an error for me.

Re: Another Danmakufu Tutorial?
« Reply #54 on: May 14, 2009, 12:40:38 AM »
Would putting tasks inside @MainLoop or something affect the yield; command in any way? Because you'd be processing everything in the MainLoop, including the task, right? So yield would...
...
Hmm, probably not, but I wouldn't want to mess around with it. They work just dandy outside any @Shit{}, so that's where I'll be keeping them, haha!



Frazer: What's your script look like?

Re: Another Danmakufu Tutorial?
« Reply #55 on: May 14, 2009, 12:54:33 AM »
Code: [Select]
#TouhouDanmakufu
#Title[Bounce Bullet]
#Text[Test script]
#Player[FREE]
#ScriptVersion[2]

script_enemy_main {
let ImgBoss = "script\thC\IMAGE\CHAR\DOT\boss_remilia.png";

let count = 540;
let a=0;





task Bounce(x, y, v, angle) {
     let obj=Obj_Create(OBJ_SHOT);

     Obj_SetPosition(obj, x, y);
     Obj_SetAngle(obj, angle);
     Obj_SetSpeed(obj, v);
     ObjShot_SetGraphic(obj, RED01);
     ObjShot_SetDelay(obj, 0);
     ObjShot_SetBombResist(obj, true);
     Obj_SetCollisionToObject(obj, true);

     while(Obj_BeDeleted(obj)==false){

           if(Obj_GetX(obj)<GetClipMinX) {
                Obj_SetAngle(obj, 180 - Obj_GetAngle(obj) ) ;
                Obj_SetX(obj, Obj_GetX(obj) + 0.1);
           }

           if(Obj_GetX(obj)>GetClipMaxX) {
                Obj_SetAngle(obj, 180 - Obj_GetAngle(obj) );
                Obj_SetX(obj, Obj_GetX(obj) - 0.1);
           }

           if(Obj_GetY(obj)<GetClipMinY) {
                Obj_SetAngle(obj, 0 - Obj_GetAngle(obj) ) ;
                Obj_SetY(obj, Obj_GetY(obj) + 0.1);
           }

           if(Obj_GetY(obj)>GetClipMaxY) {
                Obj_SetAngle(obj, 0 - Obj_GetAngle(obj) );
                Obj_SetY(obj, Obj_GetY(obj) - 0.1);
           }

           if(Collision_Obj_Obj(obj, obj)){
           Obj_SetSpeed(obj, -v)
           }

           yield;
}
}







@Initialize {
SetLife(2500);
SetTimer(60);
SetScore(10000000);

SetEnemyMarker(true);

SetMovePosition02(225, 120, 60);

LoadGraphic(ImgBoss);
SetTexture(ImgBoss);
SetGraphicRect(0, 0, 100, 100);
}

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

if(count == 600) {
loop(20){
Bounce(GetX, GetY, 5, a);

a += 360/20;
}

count=0
}
count++;
}

@DrawLoop {
DrawGraphic(GetX, GetY);
}

@Finalize {
DeleteGraphic(ImgBoss);
}
}




The bullets do not collide with each other. Do the bullets really need to be two different objects to collide with each other, or is it possible to have the bullets collide with only one ID?
« Last Edit: May 14, 2009, 01:01:44 AM by Frazer »

Garlyle

  • I can't brain today
  • I have the dumb
    • Tormod Plays Games
Re: Another Danmakufu Tutorial?
« Reply #56 on: May 14, 2009, 02:27:47 AM »
That setup won't work.

Each bullet instance (as Obj) is existing only within its personal instance of Bounce.  Each possible bullet would need to be registered as a unique 'let obj' within the main script, and commanded separately...

ugh, not quite sure how to say it, but basically, you'd want multiple 'let obj01' type lines, but you wouldn't necessarily need separate code...

long story short, b**** is ugly.

Stuffman

  • *
  • We're having a ball!
Re: Another Danmakufu Tutorial?
« Reply #57 on: May 14, 2009, 02:33:35 AM »
I haven't really messed with the object collision functions either. We need to figure that crap out at some point.

Re: Another Danmakufu Tutorial?
« Reply #58 on: May 14, 2009, 04:09:03 AM »
Consensus ad idem, Danmakufu style. I might diddle with it over the weekend if I find time, anyway... That is, if you guys don't pop it's cherry first.

Garlyle

  • I can't brain today
  • I have the dumb
    • Tormod Plays Games
Re: Another Danmakufu Tutorial?
« Reply #59 on: May 14, 2009, 05:26:03 AM »
Collision isn't too hard, just ensure declaration of 'reflector' (etc.) Objects are both A) Unique and B) public (aka the 'let' text is in normal variable location, not a task/loop/etc. )

I'll try?

EDIT: 8D Okay, does odd things once in a while, but... :3
Code: [Select]
#TouhouDanmakufu
#Title[Mirror Sign 「Border Trackers」]
#Text[Testing obj collision]
#BackGround[Default]
#BGM[.\bgm.mp3]
#PlayLevel[Test]
#Player[FREE]
#ScriptVersion[2]

script_enemy_main {
    let frame = -120;
    let arc = 0.5;
    let cx=GetCenterX();
    let minx=GetClipMinX;
    let maxx=GetClipMaxX;
    let miny=GetClipMinY;
    let maxy=GetClipMaxY;
    let cy=GetCenterY();
    let imgExRumia="script\img\ExRumia.png";
    let BossCutIn = "player\Rumia\RumiaCutIn.png";
    let SEShot = GetCurrentScriptDirectory~"sound\Eff1.wav";
    let objLaz1=Obj_Create(OBJ_LASER);
    let objLaz2=Obj_Create(OBJ_LASER);

task BoundShot(x, y, v, angle) {
      let obj=Obj_Create(OBJ_SHOT);
      Obj_SetPosition(obj, x, y);
      Obj_SetAngle(obj, angle);
      Obj_SetSpeed(obj, v);
      ObjShot_SetGraphic(obj, RED01);
      ObjShot_SetDelay  (obj, 10);
      ObjShot_SetBombResist (obj, true);
      while(Obj_BeDeleted(obj)==false) {
              if(Collision_Obj_Obj(obj,objLaz1)) {
                     Obj_SetAngle(obj,180 - Obj_GetAngle(obj) );
                     Obj_SetX(obj,Obj_GetX(objLaz1) + 5);
              }
              if(Collision_Obj_Obj(obj,objLaz2)) {
                     Obj_SetAngle(obj, 180 - Obj_GetAngle(obj) );
                     Obj_SetX(obj,Obj_GetX(objLaz2) - 5);
              }
              if(Obj_GetY(obj) < 0){
                     Obj_SetY(obj,10);
                     Obj_SetAngle(obj,180-Obj_GetAngle(obj));
              }
              yield;
       }
}

task Lasercage1() {
      Obj_SetAngle(objLaz1, 90);
      ObjLaser_SetLength(objLaz1, maxx+50);
      ObjLaser_SetWidth(objLaz1, 7);
      ObjShot_SetDelay(objLaz1, 60);
      ObjShot_SetGraphic(objLaz1, WHITE01);
      Obj_SetSpeed(objLaz1, 0);
      Obj_SetY(objLaz1, 0);
      while(Obj_BeDeleted(objLaz1)==false) {
            if(GetPlayerX-120 > minx){
                  Obj_SetX(objLaz1, GetPlayerX-120);
            }else{
                  Obj_SetX(objLaz1, minx);
            }
            Obj_SetCollisionToObject(objLaz1, true);
            ObjShot_SetBombResist(objLaz1, true);
            yield;
      }
}
task Lasercage2() {
      Obj_SetAngle(objLaz2, 90);
      ObjLaser_SetLength(objLaz2, maxx+50);
      ObjLaser_SetWidth(objLaz2, 7);
      ObjShot_SetDelay(objLaz2, 60);
      ObjShot_SetGraphic(objLaz2, WHITE01);
      Obj_SetSpeed(objLaz2, 0);
      Obj_SetY(objLaz2, 0);
      while(Obj_BeDeleted(objLaz1)==false) {
            if(GetPlayerX+120 < maxx){
                  Obj_SetX(objLaz2, GetPlayerX+120);
            }else{
                  Obj_SetX(objLaz2, maxx);
            }
            Obj_SetCollisionToObject(objLaz2, true);
            ObjShot_SetBombResist(objLaz2, true);
            yield;
      }
}

    @Initialize {
        SetLife(4000);
SetDamageRate(100,80);
SetTimer(50);
        SetInvincibility(120);
Concentration01(120);
        SetEnemyMarker(true);
        SetScore(1000000);
        SetEffectForZeroLife(120,51,1);
        LoadGraphic(imgExRumia);
        SetGraphicRect(1,1,64,64);
        CutIn(YOUMU, "Mirror Sign 「Border Trackers」", BossCutIn, 0, 0, 200, 600);
    }

    @MainLoop {
        SetCollisionA(GetX, GetY, 32);
        SetCollisionB(GetX, GetY, 24);
        SetY(90);
        SetX(GetPlayerX);
        SetShotAutoDeleteClip(175,64,175,64);
if (frame==-60){
Lasercage1;
Lasercage2;
}
frame++;
        if (frame==0){
                BoundShot(GetX,GetY,2.5,arc);
                BoundShot(GetX,GetY,2.5,arc+90);
                BoundShot(GetX,GetY,2.5,arc+180);
                BoundShot(GetX,GetY,2.5,arc+270);
                arc += rand_int(8,12);
        }
if (frame==9){
frame = -1;
}
        yield;
    }

    @DrawLoop {
SetTexture(imgExRumia);
SetGraphicRect(64,1,127,64);
DrawGraphic(GetX,GetY);
    }

    @Finalize {
loop(8){
CreateItem(ITEM_SCORE,cx+rand(-100,100),rand(20,100));
}
DeleteGraphic(imgExRumia);
    }

    @BackGround {
    }
}
« Last Edit: May 14, 2009, 06:29:01 AM by Garlyle »