Author Topic: Danmakufu Q&A/Problem Thread v3  (Read 213295 times)

Chronojet ⚙ Dragon

  • The Oddity
  • 今コソ輝ケ、我ガ未来、ソノ可能性!!
Danmakufu Q&A/Problem Thread v3
« on: January 26, 2010, 01:54:13 AM »
I decided to do something helpful for this place for once, so... OK. So the 2nd thread hit 1000 posts. That was quick. So I'll start a new thread. (Will someone lock the previous thread? Thanks for locking the second thread.)
« Last Edit: January 26, 2010, 07:25:10 PM by Koa⑨ma »

Re: Danmakufu Q&A/Problem Thread v3
« Reply #1 on: January 26, 2010, 02:18:38 AM »
Posting for updates

puremrz

  • Can't stop playing Minecraft!
Re: Danmakufu Q&A/Problem Thread v3
« Reply #2 on: January 26, 2010, 11:11:40 AM »
As a reply to the enemy health problem.
Set the Life of the enemy to, say 1010. Then when it reaches below 1000, activate whatever event you want (such as deleting object effects), and after that set the Life to 0.
With over 1000 health, it won't be possible to kill the enemy in just 1 frame (except maybe with Godrumia :V )
Full Danmakufu game "Juuni Jumon - Summer Interlude" is done!
By the same person who made Koishi Hell 1,2 (except this game is serious)
Topic: http://www.shrinemaiden.org/forum/index.php/topic,9647.0.html

Kylesky

  • *The Unknown*
  • Local Unbalanced Danmakufu Idiot Scripter
    • My useless youtube account... (will be useful in the future *I promise*)
Re: Danmakufu Q&A/Problem Thread v3
« Reply #3 on: January 26, 2010, 11:40:01 AM »
As a reply to the enemy health problem.
Set the Life of the enemy to, say 1010. Then when it reaches below 1000, activate whatever event you want (such as deleting object effects), and after that set the Life to 0.
With over 1000 health, it won't be possible to kill the enemy in just 1 frame (except maybe with Godrumia :V )

the problem here is that the health bar at the top would be really weird...
Danmakufu Script Thread :V Latest Script: Intertwining Mechanical Intervention (temp name)

Yooooouuutuuuubeeee Channel Latest Video: Contest #8 Entry

Kitsumi

  • Danmakufu Noob
Re: Danmakufu Q&A/Problem Thread v3
« Reply #4 on: January 26, 2010, 03:12:48 PM »
I don't know if this should go here, but is there any way I could run Danmakufu without Applocale (can't install due to restrictions) or without switching to Japanese locale (not able to use a superuser account) in XP?
I want to be able to write and test my scripts when I'm at school.
 Thanks in advance.

Fujiwara no Mokou

  • Hourai Incarnate
  • Oh, so this trial of guts is for ME?
    • Profile
Re: Danmakufu Q&A/Problem Thread v3
« Reply #5 on: January 26, 2010, 04:31:25 PM »
This is what you want.
There's one problem though, but I'm sure you can fix it easily. Every Japanese character of every script needs to be in english in order for it to run properly. If you don't, an error will occur and the program will shut down.

Note: This includes the player scripts. More specifically just the very beginnings of the scripts.
Code: [Select]
#TouhouDanmakufu
#Title[Japanese text usually written here, put it in English]
#Text[the same goes with the text]
#Player[default danmakufu characters(marisa and Reimu) won't bring error. IF you want to use a player made character, make sure that the japanese text is in english as well.]

Re: Danmakufu Q&A/Problem Thread v3
« Reply #6 on: January 26, 2010, 06:16:20 PM »
This is what you want.
There's one problem though, but I'm sure you can fix it easily. Every Japanese character of every script needs to be in english in order for it to run properly. If you don't, an error will occur and the program will shut down.

Note: This includes the player scripts. More specifically just the very beginnings of the scripts.
Code: [Select]
#TouhouDanmakufu
#Title[Japanese text usually written here, put it in English]
#Text[the same goes with the text]
#Player[default danmakufu characters(marisa and Reimu) won't bring error. IF you want to use a player made character, make sure that the japanese text is in english as well.]
Ohohoho, This will come in handy, How long has this been existing?!?!?!?!
On another note....Regarding one of my earilier questions,
Error, The same one i've been getting, with Load; and Draw_;In my data.txt I have Load and Draw that loads and draws the boss, If I try to run a plural file with the bosses that have Load and Draw, It crashes

DgBarca

  • Umineko fuck yeah
  • Spoilers ?
Re: Danmakufu Q&A/Problem Thread v3
« Reply #7 on: January 26, 2010, 06:32:09 PM »
Just...how to use Obj_SetCollisionToObject  ? Never used it, can we do a collision bullet/laser ?
[21:16] <redacted> dgbarca makes great work
[21:16] <redacted> i hope he'll make a full game once

Blargel

  • RAWR!
  • I'M AN ANGRY LOLI!
Re: Danmakufu Q&A/Problem Thread v3
« Reply #8 on: January 26, 2010, 09:07:56 PM »
Just...how to use Obj_SetCollisionToObject  ? Never used it, can we do a collision bullet/laser ?

Obj_SetCollisionToObject(object1, true); makes the bullet heavier to process but allows you to use Collision_Obj_Obj(object1, object2); to see if the two things are colliding or not. Only the object in the first parameter of Collision_Obj_Obj has to have SetCollisionToObject as true.

This is handy if you want two different bullets to interact with each other in a specific way. For example, if you wanted bullets to bounce of lasers, you could create an array to hold all the IDs for the lasers that will bounced off of. Then, turn on collision in the task that controls the bullets and in the while(!Obj_BeDeleted(obj)) block, you can call

ascent(i in 0..length(LaserArray)){
    if(Collision_Obj_Obj(bullet, LaserArray[ i ]){
        // do stuff if the bullet is touching the laser
    }
}


EDIT: Lol it was treating the no space version of [ i ] as italics...
« Last Edit: January 26, 2010, 09:11:19 PM by Blargel »
<WorkingKeine> when i get home i just go to the ps3 and beat people up in blazblue with a loli
<Azure> Keine: Danmakufu helper by day, violent loli by night.

DgBarca

  • Umineko fuck yeah
  • Spoilers ?
Re: Danmakufu Q&A/Problem Thread v3
« Reply #9 on: January 26, 2010, 09:23:02 PM »
Obj_SetCollisionToObject(object1, true); makes the bullet heavier to process but allows you to use Collision_Obj_Obj(object1, object2); to see if the two things are colliding or not. Only the object in the first parameter of Collision_Obj_Obj has to have SetCollisionToObject as true.

This is handy if you want two different bullets to interact with each other in a specific way. For example, if you wanted bullets to bounce of lasers, you could create an array to hold all the IDs for the lasers that will bounced off of. Then, turn on collision in the task that controls the bullets and in the while(!Obj_BeDeleted(obj)) block, you can call

ascent(i in 0..length(LaserArray)){
    if(Collision_Obj_Obj(bullet, LaserArray[ i ]){
        // do stuff if the bullet is touching the laser
    }
}


EDIT: Lol it was treating the no space version of [ i ] as italics...

Okay thanks, I will see if it works (I guess it wants to say that the laser and the bullet have to be under the same task, nah ?, it will be long task(BulletX,BulletY,BulletAngle,BulletSpeed,BulletAccAngle,BulletGraphic,BulletDelay,LaserX,LaserY,LaserLenght,LaserWidth,LaserGraphic,Laserblablablabalbalablablbalabl...)
[21:16] <redacted> dgbarca makes great work
[21:16] <redacted> i hope he'll make a full game once

Iryan

  • Ph?nglui mglw?nafh
  • Cat R?lyeh wgah?nagl fhtagn.
Re: Danmakufu Q&A/Problem Thread v3
« Reply #10 on: January 26, 2010, 09:36:45 PM »
I guess it wants to say that the laser and the bullet have to be under the same task, nah ?
Not at all.

You will simply have to create the object lasers in the main script and outside of the tasks. That way you can access them without any further problems.
You only have to store the object id in an accessable array, though. This means that you will simply create an empty array and then type a task that creates your object lasers and have it add the id of the laser to that array.

Just have this in your script_enemy_main
Code: [Select]
let obj_a=[Obj_Create(OBJ_LASER)];
Obj_Delete(obj_a[0]);
let obj_b=[];
Then create your usual object laser task, but include this line after the object creation:
Code: [Select]
obj_a[0]=obj;
obj_b=obj_b ~ obj_a;

Then you can simply give each bouncing bullet a bouncer code that runs once for each item in the array obj_b.
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."

Re: Danmakufu Q&A/Problem Thread v3
« Reply #11 on: January 26, 2010, 09:40:23 PM »
Huh, is this what you are wanting to create, in a way?

Code: [Select]
#東方弾幕風
   #Title[SampleC04]
   #Text[SampleC04:レーザーに当たった弾の軌道を変える]
   #Image[]
   #BackGround[User]
   #ScriptVersion[2]
   
   script_enemy_main
   {
      let count= -90 ;//弾を出す間隔を制御するための変数
      let cx=GetCenterX();//変数cxに中心x座標を代入
      let cy=GetCenterY();//変数cxに中心y座標を代入
      let imgExRumia=GetCurrentScriptDirectory~"imgExRumia.png";
      let arrayLaser=[];//LaserObjectのオブジェクトを保存しておく
      @Initialize()
      {
         SetLife(1000);//敵のライフを1000に設定
         SetGraphicRect(64,1,127,64);//描画元の矩形を(64,1)-(127,64)に設定
         LoadGraphic(imgExRumia);//画像「imgExRumia.png」を読みこむ     
         SetMovePosition02(cx,cy,60);//座標(cx,60)に60フレームで移動
      }
         
      @MainLoop()
      {
         if(count>0 && count%10 == 0)
         {//30フレーム毎に弾をばらまく
            let angle = 0;
            while(angle<360)
            {
               ShotObject(GetX(), GetY(), 3, angle+count*5, AQUA21, 5);
               angle+=10;
            }
         }
         if(count == 60)
         {//弾の軌道を変えるレーザー作成
            LaserObject(0,RED01);
            LaserObject(1,BLUE01);
            LaserObject(2,GREEN01);
         }
         if(count == 360)
         {//レーザー削除
            let i=0;
            loop(length(arrayLaser))
            {
               ObjShot_FadeDelete(arrayLaser);
               i++;
            }           
            count=0;//カウンタを0にする
         }
   
         SetCollisionA(GetX(),GetY(),32);//敵の座標に当たり判定を登録
         SetCollisionB(GetX(),GetY(),24);//敵の座標に当たり判定(体当たり用)を登録
         count++;//1フレーム毎にcountが1増加
         yield;//毎フレームタスク復帰
      }
     
      @DrawLoop()
      {
         SetTexture(imgExRumia);
         DrawGraphic(GetX(),GetY());//敵の座標にExルーミアを描画;
      }
     
      @Finalize()
      {
         DeleteGraphic(imgExRumia);
      }
     
      task LaserObject(let num, let grf)
      {//弾の軌道を変えるレーザー
         //numは0-2のセットで敵を中心に三角形にレーザーを出現させる
         //レーザータスク初期化
         let r=120;
         let angle=210+120*num;
         let obj = Obj_Create(OBJ_LASER);
         arrayLaser = arrayLaser~[obj];//オブジェクトをarrayLaserに登録
         Obj_SetX(obj, GetX() + r*cos(angle-150));
         Obj_SetY(obj, GetY() + r*sin(angle-150));
         Obj_SetAngle(obj, angle);
         ObjShot_SetGraphic(obj, grf);
         ObjShot_SetDelay(obj, 120);//遅延時間:120フレーム
         ObjLaser_SetLength(obj, (3^0.5)*r);//円に内接する正三角形の辺の長さ:√3*r
         ObjLaser_SetWidth(obj, 12);//レーザーの幅:12
         while( !Obj_BeDeleted(obj) )
         {
            angle+=1;//レーザーを回転
            Obj_SetX(obj, GetX() + r*cos(angle-150));
            Obj_SetY(obj, GetY() + r*sin(angle-150));
            Obj_SetAngle(obj, angle);
            yield;
         }
         
         let i=0;
         loop(length(arrayLaser))
         {//オブジェクトを削除
            if(arrayLaser == obj)
            {//配列arrayLaserからi番目の要素を削除
               arrayLaser = erase(arrayLaser, i);
               break;
            }
            i++;
         }
      }
      task ShotObject(let x, let y, let speed, let angle, let grf, let delay)
      {//レーザーに当たったら軌道を変える弾
         //弾タスク初期化
         let obj = Obj_Create(OBJ_SHOT);
         Obj_SetX(obj, x);
         Obj_SetY(obj, y);
         Obj_SetSpeed(obj, speed);
         Obj_SetAngle(obj, angle);
         ObjShot_SetGraphic(obj, grf);
         ObjShot_SetDelay(obj, delay);
         
         while( !Obj_BeDeleted(obj) )
         {//削除されるまでループを実行   
            let i=0;
            loop(length(arrayLaser))
            {//レーザーとの当り判定を調査
               if(Collision_Obj_Obj(arrayLaser, obj))
               {//Laserと接触したら
               //連続で判定されないよう普通の弾と入れ替える
               //角度も変えておく
               //数フレーム触れないようにカウンタで管理してもよいかも
                  x = Obj_GetX(obj);
                  y = Obj_GetY(obj);
                  CreateShot01(x, y, 3, Obj_GetAngle(arrayLaser)-90, grf, 0);
                  Obj_Delete(obj);
                  break;
               }
               i++;
            }     
            yield;
         }
      }   
     
   }
 
it seems if I manually add the code code (lol) that it works, interesting...
« Last Edit: January 26, 2010, 09:50:45 PM by Demonbman »

AweStriker Nova

  • Star Sign "Thunder Constellation"
Re: Danmakufu Q&A/Problem Thread v3
« Reply #12 on: January 27, 2010, 04:32:05 AM »
What. It seems you're talking about exactly what I needed.
Yayz, I can finish my extremely referential spell card

---How does one do the thing with the microtext?

Re: Danmakufu Q&A/Problem Thread v3
« Reply #13 on: January 27, 2010, 04:51:07 AM »
---How does one do the thing with the microtext?
What does that mean?

Chronojet ⚙ Dragon

  • The Oddity
  • 今コソ輝ケ、我ガ未来、ソノ可能性!!
Re: Danmakufu Q&A/Problem Thread v3
« Reply #14 on: January 27, 2010, 04:55:13 AM »
---How does one do the thing with the microtext?
You can use
Code: (How to use really small unreadable text.) [Select]
[size=1pt]text test.[/size]

Kitsumi

  • Danmakufu Noob
Re: Danmakufu Q&A/Problem Thread v3
« Reply #15 on: January 27, 2010, 02:51:41 PM »
This is what you want.
There's one problem though, but I'm sure you can fix it easily. Every Japanese character of every script needs to be in english in order for it to run properly. If you don't, an error will occur and the program will shut down.

Note: This includes the player scripts. More specifically just the very beginnings of the scripts.
Code: [Select]
#TouhouDanmakufu
#Title[Japanese text usually written here, put it in English]
#Text[the same goes with the text]
#Player[default danmakufu characters(marisa and Reimu) won't bring error. IF you want to use a player made character, make sure that the japanese text is in english as well.]
I really love you. Now I can do something productive in programming class when I'm done with my other projects.  :V Hopefully I'll get around to finishing some scripts.

Blargel

  • RAWR!
  • I'M AN ANGRY LOLI!
Re: Danmakufu Q&A/Problem Thread v3
« Reply #16 on: January 27, 2010, 03:07:18 PM »
I really love you. Now I can do something productive in programming class when I'm done with my other projects.  :V Hopefully I'll get around to finishing some scripts.

something productive

Danmakufu is something productive? :V
<WorkingKeine> when i get home i just go to the ps3 and beat people up in blazblue with a loli
<Azure> Keine: Danmakufu helper by day, violent loli by night.

Re: Danmakufu Q&A/Problem Thread v3
« Reply #17 on: January 27, 2010, 03:23:42 PM »
When there is nothing else to do, yes, I was like that last semester in my Word Processing I class, I was done with a half semesters work done in 3 weeks, So I just coded on Notepad and sent them to myself to test at home, But now I can test them at school.

Re: Danmakufu Q&A/Problem Thread v3
« Reply #18 on: January 27, 2010, 03:28:23 PM »
Danmakufu is lyfe, I lose sleep daily because of it

No seriously

;_;

Helepolis

  • Charisma!
  • *
  • O-ojousama!?
Re: Danmakufu Q&A/Problem Thread v3
« Reply #19 on: January 27, 2010, 03:45:33 PM »
Danmakufu is lyfe, I lose sleep daily because of it

No seriously

;_;

You are not the only one. Sometimes I get really obsessed to finish something and then I realise it is suddenly 2am. FFFF---

Chronojet ⚙ Dragon

  • The Oddity
  • 今コソ輝ケ、我ガ未来、ソノ可能性!!
Re: Danmakufu Q&A/Problem Thread v3
« Reply #20 on: January 27, 2010, 04:56:45 PM »
You are not the only one. Sometimes I get really obsessed to finish something and then I realise it is suddenly 2am. FFFF---
Sometimes I get distracted and I work on my Danmakufu scripts rather than my homework.... Wait, what!? This isn't even a question! Quick! Ask a question!

Hat

  • Just an unassuming chapeau.
  • I will never be ready.
Re: Danmakufu Q&A/Problem Thread v3
« Reply #21 on: January 27, 2010, 08:36:33 PM »
Code: [Select]
#TouhouDanmakufu
#Title[Test]
#Text[FUCK FUCK FUCK FUCK FUCK FUCK FUCK]
#Player[FREE]
#ScriptVersion[2]
#BGM[]

script_enemy_main {
#include_function "lib\ExtendedShotDatav4\shot_replace.dnh"
    let ImgBoss = "script\img\ExRumia.png";
let pos_draw_a = GetX;

#include_function "lib\ExtendedShotDatav4\shot_replace.dnh"
    let ImgBoss = "script\img\ExRumia.png";
let pos_draw_a = GetX;
let fgovern = -120;
let up = GetClipMinY; let left = GetClipMinX; let right = GetClipMaxX; let down = GetClipMaxY; let wide = right-left; let long = down-up;
let govern1 = true;
let govern2;
let obja;
let tick1 = 0;
let array = [];
let counter = -1;
let obj1;
//------------------AUTUMN-------------------
task T1{
loop(120){yield;}
let f1 = 0;
T1a;
ascent(f1 in 0..1080){
SetShotAutoDeleteClip(200, 200, 200, 200);
if(f1>=50 && f1%100==0){T1c;}
yield;
}
}
function T1a{
ascent(i in 0..20){
T1b(i);
}
}
task T1b(let i){
let obj = Obj_Create(OBJ_LASER);
Obj_SetPosition(obj, GetClipMaxX, (GetClipMaxY/20)*i);
Obj_SetAngle(obj, 180);
ObjShot_SetGraphic(obj, RED01);
ObjLaser_SetLength(obj, 600);
ObjLaser_SetWidth(obj, 10);
loop{
let l = length(array);
ascent(xad in 0..l){
if(Collision_Obj_Obj(obj, array[xad])){
ObjShot_SetGraphic(obj, BLUE01);
}else{ObjShot_SetGraphic(obj, RED01);}
}
yield;
}
}
task T1c{
//Creates and destroys lasers every turn, while checking for collision.
let ticker = 0;
obj1 = Obj_Create(OBJ_SHOT);
Obj_SetPosition(obj1, GetCenterX, GetClipMinY);
Obj_SetAngle(obj1, 90);
Obj_SetSpeed(obj1, 2);
ObjShot_SetGraphic(obj1, WHITE03);
array = array~[obj1];
}

    @Initialize {
        SetLife(2000);
SetInvincibility(60);
        SetTimer(99);
        SetScore(1000000);

        SetMovePosition02(GetCenterX, GetClipMinY + 120, 120);
        CutIn(YOUMU, "Test Sign "\""Test"\", "", 0, 0, 0, 0);

        LoadGraphic(ImgBoss);
        SetTexture(ImgBoss);
T1;
ShotInit;
    }

    @MainLoop {
        SetCollisionA(GetX, GetY, 32);
        SetCollisionB(GetX, GetY, 16);
//ascent(xbs in 0..length(array)){array[xbs] = array[xbs] + 2;}
yield;
    }

    @DrawLoop {
if(GetX==pos_draw_a){
SetGraphicRect(0, 0, 64, 64);
        DrawGraphic(GetX, GetY);
}
if(GetX<pos_draw_a){
SetGraphicRect(128, 0, 192, 64);
DrawGraphic(GetX, GetY);
}
if(GetX>pos_draw_a){
SetGraphicRect(192, 0, 256, 64);
DrawGraphic(GetX, GetY);
}
pos_draw_a = GetX;
DrawText(ToString(length(array)), GetClipMinX, GetCenterY, 12, 255);
    }

    @Finalize {
        DeleteGraphic(ImgBoss);
    }
}

*screams* Okay, it should be sorta clear what I'm trying to attempt, and what is going wrong. It appears DMF doesn't want to check more than two objects at once. In fact, it seems that ascent function only wants to look at the last entry in the array..... >_< AAAAAH. So tired of working on this...

Though kudos to Naut for the idea of using arrays. :V

Re: Danmakufu Q&A/Problem Thread v3
« Reply #22 on: January 28, 2010, 12:36:51 AM »
Let's take a look at your ascent function. Inside of it, you say "if you are colliding with the current bullet we're checking, set the graphic to BLUE01. If you are not, set the graphic to RED01." Well, it certainly performs all the checks correctly, until another bullet is spawned. The problem is, when the new bullet is spawned, there is a new entry in the very last index of the array, which is the last check it goes through. So it will check if it colliding with the last bullet spawned and say "Am I colliding with this particular bullet? Nope? Okay, change to RED01."

Easy solution was to just implement a counter variable that checks if it has ever changed to BLUE01 that frame, and then ignore all other commands:

Code: [Select]
#TouhouDanmakufu
#Title[Test]
#Text[FUCK FUCK FUCK FUCK FUCK FUCK FUCK]
#Player[FREE]
#ScriptVersion[2]
#BGM[]

script_enemy_main {
    let ImgBoss = "script\img\ExRumia.png";
   let pos_draw_a = GetX;
   
   let fgovern = -120;
   let up = GetClipMinY; let left = GetClipMinX; let right = GetClipMaxX; let down = GetClipMaxY; let wide = right-left; let long = down-up;
   let govern1 = true;
   let govern2;
   let obja;
   let tick1 = 0;
   let array = [];
   let counter = -1;
      //------------------AUTUMN-------------------
   task T1{
      loop(120){yield;}
      let f1 = 0;
      T1a;
      ascent(f1 in 0..1080){
         SetShotAutoDeleteClip(200, 200, 200, 200);
         if(f1>=50 && f1%100==0){T1c;}
         yield;
      }
   }
   function T1a{
   ascent(i in 0..20){
      T1b(i);
   }
   }
   task T1b(let i){
      let obj = Obj_Create(OBJ_LASER);
      Obj_SetPosition(obj, GetClipMaxX, (GetClipMaxY/20)*i);
      Obj_SetAngle(obj, 180);
      ObjShot_SetGraphic(obj, RED01);
      ObjLaser_SetLength(obj, 600);
      ObjLaser_SetWidth(obj, 10);
      loop{
         let l = length(array);
let arbitrarynumber = 0;
         ascent(xad in 0..l){
            if(Collision_Obj_Obj(obj, array[xad])){
               ObjShot_SetGraphic(obj, BLUE01);
       arbitrarynumber++;
}
if(arbitrarynumber==0){ObjShot_SetGraphic(obj, RED01);}
         }
         yield;
      }
   }
   task T1c{
   //Creates and destroys lasers every turn, while checking for collision.
      let obj1 = Obj_Create(OBJ_SHOT);
      Obj_SetPosition(obj1, GetCenterX, GetClipMinY);
      Obj_SetAngle(obj1, 90);
      Obj_SetSpeed(obj1, 2);
      ObjShot_SetGraphic(obj1, WHITE03);
      array = array~[obj1];
   }

    @Initialize {
        SetLife(2000);
      SetInvincibility(60);
        SetTimer(99);
        SetScore(1000000);

        SetMovePosition02(GetCenterX, GetClipMinY + 120, 120);
        CutIn(YOUMU, "Test Sign "\""Test"\", "", 0, 0, 0, 0);

        LoadGraphic(ImgBoss);
        SetTexture(ImgBoss);
      T1;
    }

    @MainLoop {
        SetCollisionA(GetX, GetY, 32);
        SetCollisionB(GetX, GetY, 16);
      //ascent(xbs in 0..length(array)){array[xbs] = array[xbs] + 2;}
      yield;
    }

    @DrawLoop {
      if(GetX==pos_draw_a){
      SetGraphicRect(0, 0, 64, 64);
        DrawGraphic(GetX, GetY);
      }
      if(GetX<pos_draw_a){
      SetGraphicRect(128, 0, 192, 64);
      DrawGraphic(GetX, GetY);
      }
      if(GetX>pos_draw_a){
      SetGraphicRect(192, 0, 256, 64);
      DrawGraphic(GetX, GetY);
      }
      pos_draw_a = GetX;
      DrawText(ToString(length(array)), GetClipMinX, GetCenterY, 12, 255);
    }

    @Finalize {
        DeleteGraphic(ImgBoss);
    }
}

Hat

  • Just an unassuming chapeau.
  • I will never be ready.
Re: Danmakufu Q&A/Problem Thread v3
« Reply #23 on: January 28, 2010, 03:43:45 AM »
..........

.............. screw Kanako, you should be the new god of the frickin' Moriya shrine. :V and i shall be your Sanae

KrackoCloud

  • I don't mean to be greedy...
  • ... but white rice is my favorite food.
Re: Danmakufu Q&A/Problem Thread v3
« Reply #24 on: January 28, 2010, 05:08:09 AM »
Huh, is this what you are wanting to create, in a way?

Code: [Select]
#東方弾幕風
   #Title[SampleC04]
   #Text[SampleC04:レーザーに当たった弾の軌道を変える]
   #Image[]
   #BackGround[User]
   #ScriptVersion[2]
   
   script_enemy_main
   {
      let count= -90 ;//弾を出す間隔を制御するための変数
      let cx=GetCenterX();//変数cxに中心x座標を代入
      let cy=GetCenterY();//変数cxに中心y座標を代入
      let imgExRumia=GetCurrentScriptDirectory~"imgExRumia.png";
      let arrayLaser=[];//LaserObjectのオブジェクトを保存しておく
      @Initialize()
      {
         SetLife(1000);//敵のライフを1000に設定
         SetGraphicRect(64,1,127,64);//描画元の矩形を(64,1)-(127,64)に設定
         LoadGraphic(imgExRumia);//画像「imgExRumia.png」を読みこむ     
         SetMovePosition02(cx,cy,60);//座標(cx,60)に60フレームで移動
      }
         
      @MainLoop()
      {
         if(count>0 && count%10 == 0)
         {//30フレーム毎に弾をばらまく
            let angle = 0;
            while(angle<360)
            {
               ShotObject(GetX(), GetY(), 3, angle+count*5, AQUA21, 5);
               angle+=10;
            }
         }
         if(count == 60)
         {//弾の軌道を変えるレーザー作成
            LaserObject(0,RED01);
            LaserObject(1,BLUE01);
            LaserObject(2,GREEN01);
         }
         if(count == 360)
         {//レーザー削除
            let i=0;
            loop(length(arrayLaser))
            {
               ObjShot_FadeDelete(arrayLaser);
               i++;
            }           
            count=0;//カウンタを0にする
         }
   
         SetCollisionA(GetX(),GetY(),32);//敵の座標に当たり判定を登録
         SetCollisionB(GetX(),GetY(),24);//敵の座標に当たり判定(体当たり用)を登録
         count++;//1フレーム毎にcountが1増加
         yield;//毎フレームタスク復帰
      }
     
      @DrawLoop()
      {
         SetTexture(imgExRumia);
         DrawGraphic(GetX(),GetY());//敵の座標にExルーミアを描画;
      }
     
      @Finalize()
      {
         DeleteGraphic(imgExRumia);
      }
     
      task LaserObject(let num, let grf)
      {//弾の軌道を変えるレーザー
         //numは0-2のセットで敵を中心に三角形にレーザーを出現させる
         //レーザータスク初期化
         let r=120;
         let angle=210+120*num;
         let obj = Obj_Create(OBJ_LASER);
         arrayLaser = arrayLaser~[obj];//オブジェクトをarrayLaserに登録
         Obj_SetX(obj, GetX() + r*cos(angle-150));
         Obj_SetY(obj, GetY() + r*sin(angle-150));
         Obj_SetAngle(obj, angle);
         ObjShot_SetGraphic(obj, grf);
         ObjShot_SetDelay(obj, 120);//遅延時間:120フレーム
         ObjLaser_SetLength(obj, (3^0.5)*r);//円に内接する正三角形の辺の長さ:√3*r
         ObjLaser_SetWidth(obj, 12);//レーザーの幅:12
         while( !Obj_BeDeleted(obj) )
         {
            angle+=1;//レーザーを回転
            Obj_SetX(obj, GetX() + r*cos(angle-150));
            Obj_SetY(obj, GetY() + r*sin(angle-150));
            Obj_SetAngle(obj, angle);
            yield;
         }
         
         let i=0;
         loop(length(arrayLaser))
         {//オブジェクトを削除
            if(arrayLaser == obj)
            {//配列arrayLaserからi番目の要素を削除
               arrayLaser = erase(arrayLaser, i);
               break;
            }
            i++;
         }
      }
      task ShotObject(let x, let y, let speed, let angle, let grf, let delay)
      {//レーザーに当たったら軌道を変える弾
         //弾タスク初期化
         let obj = Obj_Create(OBJ_SHOT);
         Obj_SetX(obj, x);
         Obj_SetY(obj, y);
         Obj_SetSpeed(obj, speed);
         Obj_SetAngle(obj, angle);
         ObjShot_SetGraphic(obj, grf);
         ObjShot_SetDelay(obj, delay);
         
         while( !Obj_BeDeleted(obj) )
         {//削除されるまでループを実行   
            let i=0;
            loop(length(arrayLaser))
            {//レーザーとの当り判定を調査
               if(Collision_Obj_Obj(arrayLaser, obj))
               {//Laserと接触したら
               //連続で判定されないよう普通の弾と入れ替える
               //角度も変えておく
               //数フレーム触れないようにカウンタで管理してもよいかも
                  x = Obj_GetX(obj);
                  y = Obj_GetY(obj);
                  CreateShot01(x, y, 3, Obj_GetAngle(arrayLaser)-90, grf, 0);
                  Obj_Delete(obj);
                  break;
               }
               i++;
            }     
            yield;
         }
      }   
     
   }
 
it seems if I manually add the code code (lol) that it works, interesting...

Wait. Does this actually work?
I tried it out and... The lasers aren't doing anything.

Does this mean my computer has been messed up with Danmakufu the whole time? ;_;

AweStriker Nova

  • Star Sign "Thunder Constellation"
Re: Danmakufu Q&A/Problem Thread v3
« Reply #25 on: January 28, 2010, 07:54:43 PM »
A quick question: If... wait, no, I just figured out a workaround.

Anyway, different question. Back to the object laser business. Do I have to define them all in an array, or can I do it some other way?

Oh, and another thing: So I've been tweaking Assault Wall, and now I have this...
Code: [Select]
#TouhouDanmakufu
#Title[Assault Wall "Geisterwand"]
#Text[Boxed in by bullets!]
#Player[FREE]
#ScriptVersion[2]

script_enemy_main{

let CSD = GetCurrentScriptDirectory;
let imgBoss = CSD ~ "Materials\Graphics\PlaceholderBoss.png";
let spellback = CSD ~ "Materials\Graphics\SpellBack.png";
#include_function CSD ~ "lib\ExpandedShotDatav4\shot_replace.dnh";
let slider = 0;

@Initialize{
SetLife(1000);
SetDamageRate(0,0);
SetTimer(90);
SetScore(1000);
SetMovePosition01(GetCenterX,GetCenterY-90,5);
LoadGraphic(imgBoss);
LoadGraphic(spellback);
ShotInit;
CutIn(KOUMA,"Assault Wall "\""Geisterwand"\","",0,0,0,0);
mainTask;
PlayMusic(CSD ~ "Materials\Music\33.mp3");
}

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

@DrawLoop{

SetTexture(imgBoss);
SetRenderState(ALPHA);
SetAlpha(255);
SetGraphicRect(0,0,64,64);
SetGraphicScale(1,1);
SetGraphicAngle(0,0,0);
DrawGraphic(GetX,GetY);

}

@BackGround{

SetTexture(spellback);
SetRenderState(ALPHA);
SetAlpha(255);
SetGraphicRect(0,0,448,768+slider);
SetGraphicScale(1,1);
SetGraphicAngle(0,0,0);
DrawGraphic(GetCenterX,GetCenterY);
slider+=2;

}

@Finalize{

DeleteGraphic(imgBoss);
DeleteGraphic(spellback);

}
task mainTask{
drop;
//randomly choose a type of wall at the start
let walltype = rand_int(1,4);
wait(120);
yield;
//Cast Geisterwand Defense
Ghost;
loop{
alternative(walltype)
case(1){
red;
}
case(2){
yellow;
}
case(3){
blue;
}
case(4){
green;
}
case(5){
white;
}
case(6){
aqua;
}
case(7){
orange;
}
case(8){
purple;
}
others{yield;}
wait(30);
if(GetTimer<=30){yield;
}else{
if(GetTimer<=60){
wait(30);
}else{
wait(60);
}
}
walltype = rand_int(1,4);
if(GetTimer<=4*90/5){
walltype = rand_int(1,5);
}
if(GetTimer<=3*90/5){
walltype = rand_int(1,6);
}
if(GetTimer<=2*90/5){
walltype = rand_int(1,7);
}
if(GetTimer<=90/5){
walltype = rand_int(1,8);
}
yield;
}
}

task blue{
let startside = rand_int(1,3);
alternative(startside)
case(1){
CreateEnemyFromScript("BlueWall",0,rand_int(0,480),0,0,1);
}
case(2){
CreateEnemyFromScript("BlueWall",rand_int(0,448),0,0,0,2);
}
case(3){
CreateEnemyFromScript("BlueWall",448,rand_int(0,480),0,0,1);
}
others{}
yield;
}

task red{
let startside = rand_int(1,3);
alternative(startside)
case(1){
CreateEnemyFromScript("RedWall",0,rand_int(0,480),0,0,1);
}
case(2){
CreateEnemyFromScript("RedWall",rand_int(0,448),0,0,0,2);
}
case(3){
CreateEnemyFromScript("RedWall",448,rand_int(0,480),0,0,3);
}
others{}
yield;
}

task yellow{
let startside = rand_int(1,3);
alternative(startside)
case(1){
CreateEnemyFromScript("YlwWall",0,rand_int(0,480),0,0,1);
}
case(2){
CreateEnemyFromScript("YlwWall",rand_int(0,448),0,0,0,2);
}
case(3){
CreateEnemyFromScript("YlwWall",448,rand_int(0,480),0,0,1);
}
others{}
yield;
}

task green{
let startside = rand_int(1,3);
alternative(startside)
case(1){
CreateEnemyFromScript("GreenWall",0,rand_int(0,480),0,0,1);
}
case(2){
CreateEnemyFromScript("GreenWall",rand_int(0,448),0,0,0,2);
}
case(3){
CreateEnemyFromScript("GreenWall",448,rand_int(0,480),0,0,1);
}
others{}
yield;
}

task white{
let startside = rand_int(1,3);
alternative(startside)
case(1){
CreateEnemyFromScript("WhiteWall",0,rand_int(0,480),0,0,1);
}
case(2){
CreateEnemyFromScript("WhiteWall",rand_int(0,448),0,0,0,2);
}
case(3){
CreateEnemyFromScript("WhiteWall",448,rand_int(0,480),0,0,1);
}
others{}
yield;
}

task aqua{
let startside = rand_int(1,3);
alternative(startside)
case(1){
CreateEnemyFromScript("AquaWall",0,rand_int(0,480),0,0,1);
}
case(2){
CreateEnemyFromScript("AquaWall",rand_int(0,448),0,0,0,2);
}
case(3){
CreateEnemyFromScript("AquaWall",448,rand_int(0,480),0,0,1);
}
others{}
yield;
}

task purple{
let startside = rand_int(1,3);
alternative(startside)
case(1){
CreateEnemyFromScript("PrplWall",0,rand_int(0,480),0,0,1);
}
case(2){
CreateEnemyFromScript("PrplWall",rand_int(0,448),0,0,0,2);
}
case(3){
CreateEnemyFromScript("PrplWall",448,rand_int(0,480),0,0,1);
}
others{}
yield;
}

task orange{
let startside = rand_int(1,3);
alternative(startside)
case(1){
CreateEnemyFromScript("OrangeWall",0,rand_int(0,480),0,0,1);
}
case(2){
CreateEnemyFromScript("OrangeWall",rand_int(0,448),0,0,0,2);
}
case(3){
CreateEnemyFromScript("OrangeWall",448,rand_int(0,480),0,0,1);
}
others{}
yield;
}

sub Ghost{
CreateEnemyFromScript("maceFam",GetEnemyX+50*cos(0),GetEnemyY+50*sin(0),0,0,0);
CreateEnemyFromScript("maceFam",GetEnemyX+50*cos(60),GetEnemyY+50*sin(60),0,0,60);
CreateEnemyFromScript("maceFam",GetEnemyX+50*cos(120),GetEnemyY+50*sin(120),0,0,120);
CreateEnemyFromScript("maceFam",GetEnemyX+50*cos(180),GetEnemyY+50*sin(180),0,0,180);
CreateEnemyFromScript("maceFam",GetEnemyX+50*cos(240),GetEnemyY+50*sin(240),0,0,240);
CreateEnemyFromScript("maceFam",GetEnemyX+50*cos(360),GetEnemyY+50*sin(0),0,0,300);
}

task drop{
yield;
}

function wait(w){
loop(w){yield;}
}

}

//Travels in a straight line and lays down a wall of bullets
//After 2 seconds, bullets will fly at whatever the player's position was when the bullet was planted
script_enemy BlueWall{

let CSD = GetCurrentScriptDirectory;
let imgFamB = CSD ~ "Materials\Graphics\DMF_fam.png";
#include_function "lib\ExpandedShotDatav4\shot_replace.dnh";
let frame = 0;
let startside = GetArgument;

@Initialize{
SetLife(500);
SetDamageRate(50,0);
LoadGraphic(imgFamB);
ShotInit;
maintask;

}

@MainLoop{
yield;
}

@DrawLoop{
SetTexture(imgFamB);
SetRenderState(ALPHA);
SetAlpha(255);
SetGraphicScale(1,1);
SetGraphicAngle(0,0,0);
SetGraphicRect(8,8,39,39);
DrawGraphic(GetX,GetY);
}

@Finalize{
DeleteGraphic(imgFamB);
}

function wait(n){
loop(n){yield}
}

task maintask{
wall;
alternative(startside)
case(1){
SetMovePosition02(448,rand_int(0,480),90);
}
case(2){
SetMovePosition02(rand_int(0,448),480,90);
}
case(3){
SetMovePosition02(0,rand_int(0,480),90);
}
wait(210);
VanishEnemy;
}

task wall{
while(GetSpeed>0){
CreateShotA(1,GetX,GetY,0);
SetShotDataA(1,0,0,GetAngleToPlayer,0,0,0,BLUE01);
SetShotDataA(1,120,1,NULL,0,0,0,BLUE01);
FireShot(1);
wait(5);
yield;
}
}
}

//Travels in a straight line and lays down a wall of bullets
//After 2 seconds, bullets will fly directly at the player
script_enemy RedWall{

let CSD = GetCurrentScriptDirectory;
let imgFamR = CSD ~ "Materials\Graphics\DMF_fam.png";
#include_function "lib\ExpandedShotDatav4\shot_replace.dnh";
let frame = 0;
let startside = GetArgument;

@Initialize{
SetLife(500);
SetDamageRate(50,0);
LoadGraphic(imgFamR);
ShotInit;
maintask;

}

@MainLoop{
yield;
}

@DrawLoop{
SetTexture(imgFamR);
SetRenderState(ALPHA);
SetAlpha(255);
SetGraphicScale(1,1);
SetGraphicAngle(0,0,0);
SetGraphicRect(56,8,87,39);
DrawGraphic(GetX,GetY);
}

@Finalize{
DeleteGraphic(imgFamR);
}

function wait(n){
loop(n){yield;}
}

task maintask{
wall;
alternative(startside)
case(1){
SetMovePosition02(448,rand_int(0,480),90);
}
case(2){
SetMovePosition02(rand_int(0,448),480,90);
}
case(3){
SetMovePosition02(0,rand_int(0,480),90);
}
wait(210);
VanishEnemy;
}

task wall{
while(GetSpeed>0){
redshot;
wait(5);
yield;
}
}

task redshot{
let redb = Obj_Create(OBJ_SHOT);
Obj_SetPosition(redb,GetX,GetY);
Obj_SetSpeed(redb,0);
Obj_SetAngle(redb,0);
ObjShot_SetGraphic(redb,RED01);

while(!Obj_BeDeleted(redb)){
wait(120);
Obj_SetAngle(redb,atan2(GetPlayerY-Obj_GetY(redb),GetPlayerX-Obj_GetX(redb)));
Obj_SetSpeed(redb,1);
yield;
}
}
}

//Moves in a straight line and leaves a wall of bullets
//Bullets left by YlwWall split and fly at an angle
script_enemy YlwWall{

let CSD = GetCurrentScriptDirectory;
let imgFamY = CSD ~ "Materials\Graphics\DMF_fam.png";
#include_function "lib\ExpandedShotDatav4\shot_replace.dnh";
let frame = 0;
let startside = GetArgument;

@Initialize{
SetLife(500);
SetDamageRate(50,0);
LoadGraphic(imgFamY);
ShotInit;
maintask;

}

@MainLoop{
yield;
}

@DrawLoop{
SetTexture(imgFamY);
SetRenderState(ALPHA);
SetAlpha(255);
SetGraphicScale(1,1);
SetGraphicAngle(0,0,0);
SetGraphicRect(152,8,183,39);
DrawGraphic(GetX,GetY);
}

@Finalize{
DeleteGraphic(imgFamY);
}

function wait(n){
loop(n){yield}
}

task maintask{
wall;
alternative(startside)
case(1){
SetMovePosition02(448,rand_int(0,480),90);
}
case(2){
SetMovePosition02(rand_int(0,448),480,90);
}
case(3){
SetMovePosition02(0,rand_int(0,480),90);
}
wait(210);
VanishEnemy;
}

task wall{
while(GetSpeed>0){
ylwshot;
wait(5);
yield;
}
}

task ylwshot{
let angle = GetAngle;
PlaySE(CSD ~ "Materials\SoundEffects\shot.wav");
let ylsplit = Obj_Create(OBJ_SHOT);
ObjShot_SetGraphic(ylsplit,YELLOW01);
Obj_SetSpeed(ylsplit,0);
Obj_SetAngle(ylsplit,angle+25);
Obj_SetPosition(ylsplit,GetX,GetY);
while(!Obj_BeDeleted(ylsplit)){
wait(120);
CreateShot01(Obj_GetX(ylsplit),Obj_GetY(ylsplit),1.3,angle-25,YELLOW01,0);
Obj_SetSpeed(ylsplit,1.3);
}
}
}

//Travels in a straight line and leaves a wall of bullets
//After 2 seconds, bullets explode into randomly angled lasers
script_enemy GreenWall{

let CSD = GetCurrentScriptDirectory;
let imgFamG = CSD ~ "Materials\Graphics\DMF_fam.png";
#include_function "lib\ExpandedShotDatav4\shot_replace.dnh";
let frame = 0;
let startside = GetArgument;

@Initialize{
SetLife(500);
SetDamageRate(50,0);
LoadGraphic(imgFamG);
ShotInit;
maintask;

}

@MainLoop{
yield;
}

@DrawLoop{
SetTexture(imgFamG);
SetRenderState(ALPHA);
SetAlpha(255);
SetGraphicScale(1,1);
SetGraphicAngle(0,0,0);
SetGraphicRect(104,8,135,39);
DrawGraphic(GetX,GetY);
}

@Finalize{
DeleteGraphic(imgFamG);
}

function wait(n){
loop(n){yield;}
}

task maintask{
wall;
alternative(startside)
case(1){
SetMovePosition02(448,rand_int(0,480),90);
}
case(2){
SetMovePosition02(rand_int(0,448),480,90);
}
case(3){
SetMovePosition02(0,rand_int(0,480),90);
}
wait(210);
VanishEnemy;
}

task wall{
while(GetSpeed>0){
greenshot;
wait(5);
yield;
}
}

task greenshot{
let lasangle = rand_int(0,359);
let grn = Obj_Create(OBJ_SHOT);
Obj_SetPosition(grn,GetX,GetY);
Obj_SetAngle(grn,0);
ObjShot_SetGraphic(grn,GREEN01);
ObjShot_SetDelay(grn,0);
while(!Obj_BeDeleted(grn)){
wait(120);
PlaySE(CSD ~ "Materials\SoundEffects\shot.wav");
loop(5){
CreateLaser01(Obj_GetX(grn),Obj_GetY(grn),2,lasangle,20,5,GREEN21,0);
lasangle = rand_int(0,359);
}
Obj_Delete(grn);
}
}
}

//Travels in a straight line and lays down a wall of bullets
//WhiteWall fires lasers perpendicular to the path
script_enemy WhiteWall{

let CSD = GetCurrentScriptDirectory;
let imgFamW = CSD ~ "Materials\Graphics\DMF_faml.png";
#include_function "lib\ExpandedShotDatav4\shot_replace.dnh";
let frame = 0;
let startside = GetArgument;

@Initialize{
SetLife(500);
SetDamageRate(50,0);
LoadGraphic(imgFamW);
ShotInit;
maintask;

}

@MainLoop{
yield;
}

@DrawLoop{
SetTexture(imgFamW);
SetRenderState(ALPHA);
SetAlpha(255);
SetGraphicScale(1,1);
SetGraphicAngle(0,0,0);
SetGraphicRect(8,8,39,39);
DrawGraphic(GetX,GetY);
}

@Finalize{
DeleteGraphic(imgFamW);
}

function wait(n){
loop(n){yield}
}

task maintask{
wall;
alternative(startside)
case(1){
SetMovePosition02(448,rand_int(0,480),90);
}
case(2){
SetMovePosition02(rand_int(0,448),480,90);
}
case(3){
SetMovePosition02(0,rand_int(0,480),90);
}
wait(210);
VanishEnemy;
}

task wall{
while(GetSpeed>0){
white;
wait(5);
yield;
}
}

task white{
let angle = GetAngle;
let wht = Obj_Create(OBJ_SHOT);
Obj_SetPosition(wht,GetX,GetY);
Obj_SetSpeed(wht,0);
ObjShot_SetGraphic(wht,WHITE01);
Obj_SetAngle(wht,0);
ObjShot_SetDelay(wht,0);
while(!Obj_BeDeleted(wht)){
wait(120);
CreateLaserA(1,Obj_GetX(wht),Obj_GetY(wht),500,8,WHITE47,10);
SetLaserDataA(1,0,angle+90,0,0,0,0);
CreateLaserA(2,Obj_GetX(wht),Obj_GetY(wht),500,8,WHITE47,10);
SetLaserDataA(2,0,angle-90,0,0,0,0);
PlaySE(CSD ~ "Materials\SoundEffects\laser.wav");
SetShotKillTime(1,40);
SetShotKillTime(2,40);
FireShot(1);
FireShot(2);
Obj_Delete(wht);
}
}
}

//Travels in a straight line and lays down a wall of bullets
//AquaWall bullets fire in a curved line
script_enemy AquaWall{

let CSD = GetCurrentScriptDirectory;
let imgFamA = CSD ~ "Materials\Graphics\DMF_faml.png";
#include_function "lib\ExpandedShotDatav4\shot_replace.dnh";
let frame = 0;
let startside = GetArgument;

@Initialize{
SetLife(500);
SetDamageRate(50,0);
LoadGraphic(imgFamA);
ShotInit;
maintask;

}

@MainLoop{
yield;
}

@DrawLoop{
SetTexture(imgFamA);
SetRenderState(ALPHA);
SetAlpha(255);
SetGraphicScale(1,1);
SetGraphicAngle(0,0,0);
SetGraphicRect(56,8,87,39);
DrawGraphic(GetX,GetY);
}

@Finalize{
DeleteGraphic(imgFamA);
}

function wait(n){
loop(n){yield;}
}

task maintask{
wall;
alternative(startside)
case(1){
SetMovePosition02(448,rand_int(0,480),90);
}
case(2){
SetMovePosition02(rand_int(0,448),480,90);
}
case(3){
SetMovePosition02(0,rand_int(0,480),90);
}
wait(210);
VanishEnemy;
}

task wall{
let curvature = 0.1;
while(GetSpeed>0){
aquashot(curvature);
wait(5);
curvature+=0.1;
yield;
}
}

task aquashot(curvature){
CreateShotA(1,GetX,GetY,0);
SetShotDataA(1,0,0,GetAngle,0,0,0,AQUA01);
SetShotDataA(1,120,1,NULL,curvature,0,0,AQUA01);
FireShot(1);
wait(120);
PlaySE(CSD ~ "Materials\SoundEffects\effect.wav");
}
}

//Moves in a straight line and leaves a wall of bullets
//I don't yet know what this will do.
script_enemy PrplWall{

let CSD = GetCurrentScriptDirectory;
let imgFamP = CSD ~ "Materials\Graphics\DMF_faml.png";
#include_function "lib\ExpandedShotDatav4\shot_replace.dnh";
let frame = 0;
let startside = GetArgument;

@Initialize{
SetLife(500);
SetDamageRate(50,0);
LoadGraphic(imgFamP);
ShotInit;
maintask;

}

@MainLoop{
yield;
}

@DrawLoop{
SetTexture(imgFamP);
SetRenderState(ALPHA);
SetAlpha(255);
SetGraphicScale(1,1);
SetGraphicAngle(0,0,0);
SetGraphicRect(152,8,183,39);
DrawGraphic(GetX,GetY);
}

@Finalize{
DeleteGraphic(imgFamP);
}

function wait(n){
loop(n){yield}
}

task maintask{
wall;
alternative(startside)
case(1){
SetMovePosition02(448,rand_int(0,480),90);
}
case(2){
SetMovePosition02(rand_int(0,448),480,90);
}
case(3){
SetMovePosition02(0,rand_int(0,480),90);
}
wait(210);
VanishEnemy;
}

task wall{
let baseangle = 45;
while(GetSpeed>0){
prplshot(baseangle);
wait(5);
baseangle-=3;
yield;
}
}

task prplshot(baseangle){
CreateShotA(1,GetX,GetY,0);
SetShotDataA(1,0,0,GetAngle,0,0,0,PURPLE01);
SetShotKillTime(1,240);
CreateLaserA(2,GetX,GetY,30,8,PURPLE41,5);
SetLaserDataA(2,0,baseangle,0.2,0,0,0);
FireShot(1);
AddShot(115,1,2,0);
wait(120);
PlaySE(CSD ~ "Materials\SoundEffects\laser.wav");
}
}

//Travels in a straight line and leaves a wall of bullets
//Bullets fire a laser that blocks the wall temporarily
script_enemy OrangeWall{

let CSD = GetCurrentScriptDirectory;
let imgFamO = CSD ~ "Materials\Graphics\DMF_faml.png";
#include_function "lib\ExpandedShotDatav4\shot_replace.dnh";
let frame = 0;
let startside = GetArgument;

@Initialize{
SetLife(500);
SetDamageRate(50,0);
LoadGraphic(imgFamO);
ShotInit;
maintask;

}

@MainLoop{
yield;
}

@DrawLoop{
SetTexture(imgFamO);
SetRenderState(ALPHA);
SetAlpha(255);
SetGraphicScale(1,1);
SetGraphicAngle(0,0,0);
SetGraphicRect(104,8,135,39);
DrawGraphic(GetX,GetY);
}

@Finalize{
DeleteGraphic(imgFamO);
}

function wait(n){
loop(n){yield;}
}

task maintask{
wall;
alternative(startside)
case(1){
SetMovePosition02(448,rand_int(0,480),90);
}
case(2){
SetMovePosition02(rand_int(0,448),480,90);
}
case(3){
SetMovePosition02(0,rand_int(0,480),90);
}
wait(210);
VanishEnemy;
}

task wall{
while(GetSpeed>0){
oranshot;
wait(5);
yield;
}
}

task oranshot{
let lasangle = GetAngle;
let oran = Obj_Create(OBJ_SHOT);
Obj_SetPosition(oran,GetX,GetY);
Obj_SetAngle(oran,GetAngle);
ObjShot_SetGraphic(oran,ORANGE01);
ObjShot_SetDelay(oran,0);
while(!Obj_BeDeleted(oran)){
wait(120);
PlaySE(CSD ~ "Materials\SoundEffects\laser.wav");
CreateLaserA(1,Obj_GetX(oran),Obj_GetY(oran),500,8,ORANGE47,10);
SetLaserDataA(1,0,lasangle,0,0,0,0);
SetShotKillTime(1,40);
FireShot(1);
CreateLaserA(2,Obj_GetX(oran),Obj_GetY(oran),500,8,ORANGE47,10);
SetLaserDataA(2,0,lasangle+180,0,0,0,0);
SetShotKillTime(2,40);
FireShot(2);
wait(20);
Obj_Delete(oran);
}
}
}

//Geisterwand Mace Shield
script_enemy maceFam{

let CSD = GetCurrentScriptDirectory;
let imgFam = CSD ~ "Materials\Graphics\GeisterwandSprite.png";
#include_function "lib\ExpandedShotDatav4\shot_replace.dnh";
let dir = GetArgument;
let r = 50;
let spin = GetArgument+90;
let frame = 0;

@Initialize{
SetLife(1);
SetDamageRate(0,0);
LoadGraphic(imgFam);
ShotInit;
maintask;

}

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

@DrawLoop{
SetTexture(imgFam);
SetRenderState(ALPHA);
SetAlpha(255);
SetGraphicScale(1,1);
SetGraphicAngle(0,0,spin);
SetGraphicRect(0,0,30,31);
DrawGraphic(GetX,GetY);

spin+=5;

}

@Finalize{
DeleteGraphic(imgFam);
}

task maintask{
yield;
move;
}

task move{
loop{
//shoot direction of movement and 30 degrees off every 15 frames
if(frame == 7){
PlaySE(CSD ~ "Materials\SoundEffects\shot.wav");
CreateShot01(GetX,GetY,3,dir+90,WHITE12I,0);
frame = 0;
}
SetMovePosition03(GetEnemyX+3*r*cos(dir),GetEnemyY+3*r*sin(dir),20,10);
dir+=5;
frame++;
r=50+10*sin(frame);
yield;
}
}

function wait(n){
loop(n){yield;}
}
}
There are a couple of problems with this script as it is...
First and foremost: Except for the black bullets from the mace... things (no one seems to agree on just what those are), no bullets show up. Ever. Is GetSpeed incompatible with SetMovePosition02 or something?
« Last Edit: January 28, 2010, 08:36:18 PM by AweStriker Nova »

Re: Danmakufu Q&A/Problem Thread v3
« Reply #26 on: January 28, 2010, 10:38:35 PM »
I think you want GetSpeedX

AweStriker Nova

  • Star Sign "Thunder Constellation"
Re: Danmakufu Q&A/Problem Thread v3
« Reply #27 on: January 28, 2010, 11:23:39 PM »
I think you want GetSpeedX
There is no GetSpeedX

Chronojet ⚙ Dragon

  • The Oddity
  • 今コソ輝ケ、我ガ未来、ソノ可能性!!
Re: Danmakufu Q&A/Problem Thread v3
« Reply #28 on: January 28, 2010, 11:42:43 PM »
Yes, there is. I like to use while(GetSpeedX!=0) { yield; } to delay my tasks until the boss is done moving.

AweStriker Nova

  • Star Sign "Thunder Constellation"
Re: Danmakufu Q&A/Problem Thread v3
« Reply #29 on: January 29, 2010, 12:08:58 AM »
Huh. Well the Wiki doesn't have it...

Oh, it was in Enemy Control instead of Mathematical and Information.
« Last Edit: January 29, 2010, 01:12:02 AM by AweStriker Nova »