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

Henry

  • The observer
  • Exploring to the new world of Danmaku
Re: Danmakufu Q&A/Problem Thread
« Reply #930 on: October 15, 2009, 05:13:21 AM »
What is the difference between GetX and GetX()?

is there a way to once a angle equals a certain...angle that it can switch?
im not sure if you can put an if statement in another if statement.

Surely, you can do so...

Code: [Select]
if(condition1){
   if(condition2){
    ...
   }
}
but then I would prefer this:
Code: [Select]
if(condition1 && condition2){ //the two happens at same time
   ...
}
Old/Forgotten member.

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

Re: Danmakufu Q&A/Problem Thread
« Reply #931 on: October 15, 2009, 05:39:45 AM »
Surely, you can do so...

Code: [Select]
if(condition1){
   if(condition2){
    ...
   }
}
but then I would prefer this:
Code: [Select]
if(condition1 && condition2){ //the two happens at same time
   ...
}

not quite what i ment, like:
 if(angle=>300){
    angle=30;

but then have it repeat its self

CK Crash

  • boozer
Re: Danmakufu Q&A/Problem Thread
« Reply #932 on: October 15, 2009, 10:31:51 AM »
While() statements will loop until the condition is met. For example:

Code: [Select]
while(x >= 360){x -= 360;}
while(x < 0){x += 360;}

This code always makes x (probably an angle of some sort) between 0 and 360. Just be careful that there is no chance of it looping forever unless it's in a task and you're yielding.

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
« Reply #933 on: October 15, 2009, 11:03:18 AM »
is there a way to input the value of pi in danmakufu? or should it just be 22/7, cause it's not the exact value of pi...
Danmakufu Script Thread :V Latest Script: Intertwining Mechanical Intervention (temp name)

Yooooouuutuuuubeeee Channel Latest Video: Contest #8 Entry

Henry

  • The observer
  • Exploring to the new world of Danmaku
Re: Danmakufu Q&A/Problem Thread
« Reply #934 on: October 15, 2009, 12:20:50 PM »
define it yourself:

let pi=3.1415926535; (any longer would be wasting the resource, because the error is negligible)
Old/Forgotten member.

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

KomeijiKoishi

Re: Danmakufu Q&A/Problem Thread
« Reply #935 on: October 15, 2009, 01:00:32 PM »
Code: [Select]
#TouhouDanmakufu
#Title[maxwell - "D-A-N-M-A-K-U"]
#Text[Maxwell gets out his notepad and summons danmaku by simply writing it.]
#ScriptVersion[1]

script_enemy_main {

    let D = "script\D.png";
    let A = "script\A.png";
    let N = "script\N.png";
    let M = "script\M.png";
    let K = "script\K.png";
    let U = "script\U.png";

    let count1=0;

    let life = 1600;

    let crap = 200;

    let time = 140;

    let l = 0;

    let reqmaxX = GetClipMaxX;
    let reqminX = GetClipMinY;
    let reqmaxY = GetClipMaxY;
    let reqminY = GetClipMinY;

    let kee = 0;

    @Initialize {
        SetLife(1600);
        SetDamageRate(10, 0);
        SetScore(210000);
        SetTimer(130);
        SetInvincibility( 200 );
        LoadGraphic(ImgBoss);
        LoadGraphic(D);
        LoadGraphic(A);
        LoadGraphic(N);
        LoadGraphic(M);
        LoadGraphic(K);
        LoadGraphic(U);
        CutIn(KOUMA, "Maxwell "\""D-A-N-M-A-K-U"\", "", 0, 0, 0, 0);
        LoadUserShotData("\script\extrabosses_mcxd\images\supershot.txt");

        SetMovePosition02(GetCenterX, GetClipMinY + 120, 120);
        SetGraphicRect(0, 0, 64, 64);
    }

    @MainLoop {
    if (!OnBomb) {
    SetCollisionA(GetX, GetY, 32);
    SetCollisionB(GetX, GetY, 16);
    }

    if (count1 == 150){
    kill;
    controller;
    }

    count1++;
    time = GetTimer;
    life = GetEnemyLife;
    yield;
    }

    @DrawLoop {
    if (!OnBomb) {
        SetGraphicAngle(0, 0, 0);
        SetGraphicRect(0, 0, 44, 50);
        SetGraphicScale(1, 1);
        }
    }

    @Finalize {
        DeleteGraphic(ImgBoss);
    }


    task controller(){
        loop{
        if (l == 0){
        if (life < 650){
        crap = 170;
        l++;
        }
        }
        if (l == 1){
        if (life < 500){
        crap = 140;
        l++;
        }
        }
        if (l == 2){
        if (life < 350){
        crap = 110;
        l++;
        }
        }
        if (time < 20){
        if (l != 20){
        l = 20;
        crap = 70;
        }
        }
        yield;
        }
    }

    task kill(){
        let x;
        let y;
        let a;
        loop{
        x = rand(GetClipMinX + 100, GetClipMaxX - 100);
        y = rand(GetClipMinY + 80, GetClipMinY + 160);
        ascent(a in 0..20){
        Slowbie((GetClipMaxX-GetClipMinX)*2/14, GetY, 3.5, atan2(GetPlayerY - GetY, GetPlayerX - (GetClipMaxX-GetClipMinX)*2/14)+a*18, 240, 50, 0);
        Slowbie((GetClipMaxX-GetClipMinX)*2/14, GetY, 3, atan2(GetPlayerY - GetY, GetPlayerX - (GetClipMaxX-GetClipMinX)*2/14)+9+a*18, 240, 50, 0);
        Slowbie((GetClipMaxX-GetClipMinX)*2/14, GetY, 2.5, atan2(GetPlayerY - GetY, GetPlayerX - (GetClipMaxX-GetClipMinX)*2/14)+a*18, 240, 50, 0);
        Slowbie((GetClipMaxX-GetClipMinX)*2/14, GetY, 2, atan2(GetPlayerY - GetY, GetPlayerX - (GetClipMaxX-GetClipMinX)*2/14)+9+a*18, 240, 50, 0);
        SetTexture(D);
        SetGraphicRect( 0, 0, 44, 50 );
        DrawGraphic(((GetClipMaxX-GetClipMinX)*2/14), GetClipMinX + 95);
        }
        if (GetLife<1400){
        ascent(a in 0..100){
        Slowbie((GetClipMaxX-GetClipMinX)*4/14, GetY, rand(1, 3), rand(0, 360), 46, 50, 0);
        SetTexture(A);
        DrawGraphic(((GetClipMaxX-GetClipMinX)*4/14), GetClipMinX + 95);
        SetGraphicRect( 0, 0, 44, 50 );
        }
}
        if (GetLife<1200){
        ascent(a in 0..85){
        Slowbie((GetClipMaxX-GetClipMinX)*6/14, GetY, 2.5, atan2(GetPlayerY - GetY, GetPlayerX - (GetClipMaxX-GetClipMinX)*6/14)+180-a*2, 52, a, 0);
        Slowbie((GetClipMaxX-GetClipMinX)*6/14, GetY, 2.5, atan2(GetPlayerY - GetY, GetPlayerX - (GetClipMaxX-GetClipMinX)*6/14)+180+a*2, 52, a, 0);
        SetTexture(N);
        SetGraphicRect( 0, 0, 44, 50 );
        DrawGraphic(((GetClipMaxX-GetClipMinX)*6/14), GetClipMinX + 95);
        }
}
        if (GetLife<1000){
        ascent(a in 6..21){
        Slowbie((GetClipMaxX-GetClipMinX)*8/14, GetY, a/3, GetAngleToPlayer-30, 81, 50, 0);
        Slowbie((GetClipMaxX-GetClipMinX)*8/14, GetY, a/3, GetAngleToPlayer, 81, 50, 0);
        Slowbie((GetClipMaxX-GetClipMinX)*8/14, GetY, a/3, GetAngleToPlayer+30, 81, 50, 0);
        SetTexture(M);
        SetGraphicRect( 0, 0, 44, 50 );
        DrawGraphic(((GetClipMaxX-GetClipMinX)*8/14), GetClipMinX + 95);
        }
}
        if (GetLife<800){
        ascent(a in 0..20){
        Slowbie((GetClipMaxX-GetClipMinX)*10/14, GetY, 2, atan2(GetPlayerY - GetY, GetPlayerX - (GetClipMaxX-GetClipMinX)*14/14)+a*18, 130, 50, 0);
        Slowbie((GetClipMaxX-GetClipMinX)*10/14, GetY, 2.1, atan2(GetPlayerY - GetY, GetPlayerX - (GetClipMaxX-GetClipMinX)*14/14)-1+a*18, 130, 50, 0);
        Slowbie((GetClipMaxX-GetClipMinX)*10/14, GetY, 2.2, atan2(GetPlayerY - GetY, GetPlayerX - (GetClipMaxX-GetClipMinX)*14/14)-2+a*18, 130, 50, 0);
        Slowbie((GetClipMaxX-GetClipMinX)*10/14, GetY, 2.3, atan2(GetPlayerY - GetY, GetPlayerX - (GetClipMaxX-GetClipMinX)*14/14)-3+a*18, 130, 50, 0);
        Slowbie((GetClipMaxX-GetClipMinX)*10/14, GetY, 2.4, atan2(GetPlayerY - GetY, GetPlayerX - (GetClipMaxX-GetClipMinX)*14/14)-4+a*18, 130, 50, 0);
        Slowbie((GetClipMaxX-GetClipMinX)*10/14, GetY, 2.5, atan2(GetPlayerY - GetY, GetPlayerX - (GetClipMaxX-GetClipMinX)*14/14)-5+a*18, 130, 50, 0);
        Slowbie((GetClipMaxX-GetClipMinX)*10/14, GetY, 2.6, atan2(GetPlayerY - GetY, GetPlayerX - (GetClipMaxX-GetClipMinX)*14/14)-6+a*18, 130, 50, 0);
        SetTexture(A);
        SetGraphicRect( 0, 0, 44, 50 );
        DrawGraphic(((GetClipMaxX-GetClipMinX)*10/14), GetClipMinX + 95);
        }
}
        if (GetLife<600){
        ascent(a in 0..20){
        Home((GetClipMaxX-GetClipMinX)*12/14, GetY, 2, GetAngleToPlayer+a*18, 111, 50+a*4, a);
        SetTexture(K);
        SetGraphicRect( 0, 0, 44, 50 );
        DrawGraphic(((GetClipMaxX-GetClipMinX)*12/14), GetClipMinX + 95);
        }
}
        if (GetLife<400){
        ascent(a in 0..30){
        Slowbie((GetClipMaxX-GetClipMinX)*14/14, GetY, 2.5, GetAngleToPlayer+a*12, 59, 50, 4);
        Slowbie((GetClipMaxX-GetClipMinX)*14/14, GetY, 2.5, GetAngleToPlayer+a*12, 59, 50, -4);
        SetTexture(U);
        SetGraphicRect( 0, 0, 44, 50 );
        DrawGraphic(((GetClipMaxX-GetClipMinX)*14/14), GetClipMinX + 95);
        }

}
        _Wait(200);
        }
        }
       

    task Slowbie(x, y, v, angle, graphic, delay, let turn){
        let obj = Obj_Create(OBJ_SHOT);
        let bounce = 0;
        let i = 0;
        Obj_SetX(obj, x);
        Obj_SetY(obj, y);
        Obj_SetSpeed(obj, v);
        Obj_SetAngle(obj, angle);
        ObjShot_SetGraphic(obj, graphic);
        ObjShot_SetDelay(obj, delay);
        Obj_SetAutoDelete(obj, false);
        ObjShot_SetBombResist(obj, true);
          while (!Obj_BeDeleted(obj)){

          if (bounce == 0){
          if ((Obj_GetX(obj) > 420) || (Obj_GetX(obj) < 30)){
              Obj_SetAngle(obj, Obj_GetAngle(obj));
          bounce++;
          }
     if (Obj_GetY(obj) < 15){
          Obj_SetAngle(obj, Obj_GetAngle(obj));
          bounce++;
          }
          }

          if ((i > 10+delay) && (i < 70+delay)){
          Obj_SetAngle(obj, Obj_GetAngle(obj)+turn);
          }


          if ((i > 140+delay)){
          Obj_SetAutoDelete(obj, true);
          }

          i++;
          yield;
          }
     }


    task Home(x, y, v, angle, graphic, delay, let turn){
        let obj = Obj_Create(OBJ_SHOT);
        let bounce = 0;
        let i = 0;
        Obj_SetX(obj, x);
        Obj_SetY(obj, y);
        Obj_SetSpeed(obj, v);
        Obj_SetAngle(obj, angle);
        ObjShot_SetGraphic(obj, graphic);
        ObjShot_SetDelay(obj, delay);
        Obj_SetAutoDelete(obj, false);
        ObjShot_SetBombResist(obj, true);
          while (!Obj_BeDeleted(obj)){

          if (bounce == 0){
          if ((Obj_GetX(obj) > 420) || (Obj_GetX(obj) < 30)){
              Obj_SetAngle(obj, Obj_GetAngle(obj));
          bounce++;
          }
     if (Obj_GetY(obj) < 15){
          Obj_SetAngle(obj, Obj_GetAngle(obj));
          bounce++;
          }
          }


          if ((i == 40+delay)){
          Obj_SetAngle(obj, atan2(GetPlayerY - Obj_GetY(obj), GetPlayerX - Obj_GetX(obj)))
          }


          if ((i > 140)){
          Obj_SetAutoDelete(obj, true);
          }

          i++;
          yield;
          }
     }


    task YamaReflect(num, spe, turn, graph, delay){
         let offset=0;
         loop{
           ascent(i in 0..num){
               CreateShot01(GetX, GetY, spe, (360)/num*i+offset, graph, 10);
           }
         offset+=turn;
         loop(delay){yield;}
         PlaySE("script\extrabosses_mcxd\sound\Shot6.wav");
         }
    }
    task Permashot(x, y, v, angle, graphic, delay){
        let obj = Obj_Create(OBJ_SHOT);
        Obj_SetX(obj, x);
        Obj_SetY(obj, y);
        Obj_SetSpeed(obj, v);
        Obj_SetAngle(obj, angle);
        ObjShot_SetGraphic(obj, graphic);
        ObjShot_SetDelay(obj, delay);
   Obj_SetAutoDelete(obj, false);
        ObjShot_SetBombResist(obj, true);
          while (!Obj_BeDeleted(obj)){
          yield;
          }
     }

function _Wait( let frame ){
   loop( frame ){ yield; }
}

}
How can I draw all the letters on their destinated spots? Now they don't appear at all, but before I deleted certain parts of the code they all appeared on the D.

764asd

Re: Danmakufu Q&A/Problem Thread
« Reply #936 on: October 15, 2009, 02:46:04 PM »
I Have a question to ask here. Whenever I Run some scripts ( and my own script made by following the tutorial provided by Helepolis) with Danmakufu, this error appears, as stated by Touhou Danmakufu Wiki:

"<script>内で「{...}」が対応していません"

Inside script is ' Script_enemy_main". Some of the scripts I Get could not run because of that. My friend tried and said that the same script he is using works, but mine does not. Any ideas on this...
« Last Edit: October 15, 2009, 03:00:50 PM by 764asd »

Re: Danmakufu Q&A/Problem Thread
« Reply #937 on: October 15, 2009, 03:10:10 PM »
I Have a question to ask here. Whenever I Run some scripts ( and my own script made by following the tutorial provided by Helepolis) with Danmakufu, this error appears, as stated by Touhou Danmakufu Wiki:

"<script>内で「{...}」が対応していません"

Jesus Christ.
It means your braces are not in alignment. You're missing some {}.

@VideoGameCrack:

Didn't think you could put DrawGraphic outside of @DrawLoop and @BackGround. Try putting it all in the @DrawLoop, but provide conditional statements:

Code: [Select]
@DrawLoop{
   if(var==true){
      SetTexture(D);
      SetGraphicRect(blah, blah, blah, blah);
      DrawGraphic(x, y);
   }
   if(var2==true){
      SetTexture(A);
      SetGraphicRect(blah, blah, blah, blah);
      DrawGraphic(x, y);
   }
//etc.
}

And just set global variables to equal true whenever you want a graphic to appear.

KomeijiKoishi

Re: Danmakufu Q&A/Problem Thread
« Reply #938 on: October 15, 2009, 03:56:00 PM »


Thanks. Do you wanna have a LuNautic version of the script?

Lawence Codye

  • The Nine Tails of Subconscious...
  • Come & your desires shall all become reality...
Re: Danmakufu Q&A/Problem Thread
« Reply #939 on: October 15, 2009, 05:38:45 PM »
Thanks again Naut...& now...
okay...now I have two more questions...
1. this is my @DrawLoop for my player script...
Code: [Select]
@DrawLoop{
      SetTexture(img_reimu);
      if(GetKeyState(VK_LEFT)==KEY_PUSH || GetKeyState(VK_LEFT)==KEY_HOLD){
         SetGraphicRect(326, 85, 359, 131);
      }else if(GetKeyState(VK_RIGHT)==KEY_PUSH || GetKeyState(VK_RIGHT)==KEY_HOLD){
         SetGraphicRect(327, 153, 360, 199);
      }else{
         SetGraphicRect(326, 16, 360, 62);
      }
      DrawGraphic(GetPlayerX(), GetPlayerY());
   }
why I'm showing this is cause I need to find out how to animate my sprite...like some others have before me?
If you(whoever) need to see more of my code...say so & it's done...& also
2. Is there a way to have a player's options to do what they do in the image below when focused only...?

I am the Nine Tails of Subconscious...

Come & your greatest desires will be reality...

Re: Danmakufu Q&A/Problem Thread
« Reply #940 on: October 15, 2009, 06:36:07 PM »
Thanks. Do you wanna have a LuNautic version of the script?

This should be the only question never asked in this thread. Of course, love.



@UltimaRepman:
1. Create a global variable:
let count = 0;
Increment it at the beginning of your @DrawLoop:
Code: [Select]
@DrawLoop{
   count++;
   //...
}
And make conditional statements using the incrementing variable to determine which image you will display for which button state:
Code: [Select]
@DrawLoop{
      count++;
      SetTexture(img_reimu);
      if(GetKeyState(VK_LEFT)==KEY_PUSH || GetKeyState(VK_LEFT)==KEY_HOLD){
         if(count%15>=0 && count%15<5){
             SetGraphicRect(326, 85, 359, 131);
         }
         if(count%15>=5 && count%15<10){
             SetGraphicRect(243, 85, 276, 131);
         }
         if(count%15>=10 && count%15<15){
             SetGraphicRect(278, 85, 311, 131);
         }
      }else if(GetKeyState(VK_RIGHT)==KEY_PUSH || GetKeyState(VK_RIGHT)==KEY_HOLD){
         if(count%15>=0 && count%15<5){
             SetGraphicRect(0, 85, 100, 131);
         }
         if(count%15>=5 && count%15<10){
             SetGraphicRect(200, 85, 300, 131);
         }
         if(count%15>=10 && count%15<15){
             SetGraphicRect(100, 85, 200, 131);
         }
      }else{
         if(count%15>=0 && count%15<5){
             SetGraphicRect(326, 0, 359, 45);
         }
         if(count%15>=5 && count%15<10){
             SetGraphicRect(243, 45, 276, 90);
         }
         if(count%15>=10 && count%15<15){
             SetGraphicRect(278, 90, 311, 135);
         }
      }
      DrawGraphic(GetPlayerX(), GetPlayerY());
   }
You can just copy/paste this code if you want, it works (provided you declare count), you'll need to replace all the GraphicRect's though.

2. If I'm seeing the image correctly... The options have disappeared? Can't remember ReimuC from MoF... If you're using ObjEffects:

ObjEffect_SetVertexColor(obj, [0-3], 0, 255, 255, 255); //repeat for all four vertices.

Notice the third parameter -- the alpha value. 0 alpha makes it transparent (disappear). You probably know where I'm going with this: If you're using the @DrawLoop, use SetAlpha(0);, though I wouldn't recommend using the @DrawLoop to draw options. I doubt you are anyway.
« Last Edit: October 15, 2009, 06:39:55 PM by Naut »

Henry

  • The observer
  • Exploring to the new world of Danmaku
Re: Danmakufu Q&A/Problem Thread
« Reply #941 on: October 16, 2009, 12:22:31 AM »
ok right forum:
How do you replace the Background image in the danmakufu menus?
and the annoying Default Marisa and Reimu white colors?
You can add script sheets into /player.
Try looking for Reimu's and Marisa's sheets in CtC :)

Quote from: Naut
2. If I'm seeing the image correctly... The options have disappeared? Can't remember ReimuC from MoF... If you're using ObjEffects:
No... In fact they just hide behind (in front of???) our shrine maiden when one focuses.


Btw, you can actually add a Title.png to \img for the title image, but still the result is bad :(
« Last Edit: October 16, 2009, 01:56:09 AM by Henry »
Old/Forgotten member.

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

Cabble

  • Ask me about my Cat.
  • Not unwilling to shank you.
Re: Danmakufu Q&A/Problem Thread
« Reply #942 on: October 17, 2009, 12:29:27 AM »
Now that I have a weekend to devote to danmakufu - I have a question

What would I make a menu system with, and what difficulty would it be to make it?
I had a teacher who used to play radiohead during class once.

ONCE.

Nuclear Cheese

  • Relax and enjoy the danmaku.
    • My homepage
Re: Danmakufu Q&A/Problem Thread
« Reply #943 on: October 17, 2009, 01:15:45 AM »
Now that I have a weekend to devote to danmakufu - I have a question

What would I make a menu system with, and what difficulty would it be to make it?

The way I do menus is with a stage script, which draws menu options and tracks what's selected.  It's a bit of a pain in the ass, but it gets the job done decently.

You can see examples in my recent scripts here - specifically, 「Bullet Curtain」 and Never Twice the Same Danmaku.
to quote Naut:
"I can see the background, there are too many safespots."
:V

Cabble

  • Ask me about my Cat.
  • Not unwilling to shank you.
Re: Danmakufu Q&A/Problem Thread
« Reply #944 on: October 17, 2009, 01:38:11 AM »
The way I do menus is with a stage script, which draws menu options and tracks what's selected.  It's a bit of a pain in the ass, but it gets the job done decently.

You can see examples in my recent scripts here - specifically, 「Bullet Curtain」 and Never Twice the Same Danmaku.
Just cover it up with images and it'd look like a menu?

Thanks. But oh my god that script scares me.
I had a teacher who used to play radiohead during class once.

ONCE.

Re: Danmakufu Q&A/Problem Thread
« Reply #945 on: October 17, 2009, 03:26:45 AM »
Hm. I tried messing with backgrounds for the past couple of nights, and I hit a strange obstacle, so I thought I would make a question of it.

Why is it that even if you specify the boss image and the background image to @DrawLoop and @Background respectively, the background SetGraphicRect will apply to the boss image as well?

This does not happen normally if you have a set graphic for the boss in @DrawLoop, but it is a completely different story if you have a function of movement (in which their graphic changes while they move/are idle, like in CtC). The problem here is that, if I want this function on my boss, at certain points where the SetGraphicRect for the boss may not be defined properly (which seems to somehow be the case especially when they are idle, when I define a SetGraphicRect for GetSpeedX == 0 as their idle image. However, this seems to be random, with one boss image, it works fine when I define this, but with the other, it goes awry any way), it goes to the one for the background instead and puts in several images of the boss at once instead of the single desired image. This completely throws me off, since they are both defined in separate loops.

I know I am either very complex or just extremely confusing overall with this explanation, but if I wanted to provide examples, it would involve several different images you would most likely not have, and I am not uploading files anytime soon.

What should I do to fix the problem, keep my boss image rects constant while also having my background? Any tips, please?

If there is something I can make clearer in my explanation, I would like to know.

Azure Lazuline

  • Looooove!!
  • PM me for free huggles and love!
    • Entanma Project - indie game development
Re: Danmakufu Q&A/Problem Thread
« Reply #946 on: October 17, 2009, 03:35:17 AM »
All drawing functions stay as they are until re-defined, even in different loops. Call everything directly before the boss's drawing routine - you probably have SetGraphicRect after DrawGraphic.

Re: Danmakufu Q&A/Problem Thread
« Reply #947 on: October 17, 2009, 03:50:40 AM »
Either I am doing it incorrectly, or I am misunderstanding what you are meaning. Would you be able to give me an example?

Here is an example of what I am doing in my drawloop:

Code: [Select]
@DrawLoop{
SetTexture(yuyuback);
SetRenderState(ALPHA);
SetAlpha(fadein);
SetGraphicRect(0, 0, 256, 256);
SetGraphicScale(2.25,2.25);
DrawGraphic(GetCenterX, GetCenterY + bgscroll);

if(count%1 == 0){
if(fadein < 253){
fadein += 2;
}
}



SetTexture(yuyuback2);
SetRenderState(ALPHA);
SetAlpha(255);
SetGraphicRect(0, 0, 256, 256);
SetGraphicScale(2.25,2.25);
DrawGraphic(GetCenterX, GetCenterY);

bgscroll += 2;
if(bgscroll > 510){
bgscroll = 0;
}



SetTexture(ImgBoss);
SetRenderState(ALPHA);
SetAlpha(255);
SetGraphicScale(1,1);
SetGraphicAngle(0,0,0);
setGraphicMove;
DrawGraphic(GetX, GetY);
}

Imgboss is self-explanatory, yuyuback is Yuyuko's background. fadein and bgscroll are trivial matters right now.

Re: Danmakufu Q&A/Problem Thread
« Reply #948 on: October 17, 2009, 03:59:21 AM »
Every function that has "Set" in it's name1 needs only be called once for it to continue running.
I bold so other people get this message as well, since it is important.
1The only exception to this is rule the function SetFog.


So since you "set" the graphic rectangular region to be (0, 0, 256, 256), all images that use that function to determine the graphic rect will use those coordinates until specified otherwise, continuing on to other frames if need be. You do not declare a new graphic rect for the boss, so Danmakufu will use the last one you set, which in this case is your background's.

Cabble

  • Ask me about my Cat.
  • Not unwilling to shank you.
Re: Danmakufu Q&A/Problem Thread
« Reply #949 on: October 17, 2009, 04:00:46 AM »
Whenever I start up this spellcard, nothing happens and then it ends, acting like I won.

Probably a newbie mistake but oh well  :V

Code: [Select]
#TouhouDanmakufu
#Title[IkuSpell1]
#Text[Water Sign "Electrically Charged Current"]
#Player[FREE]
#ScriptVersion[0.01]
script_enemy_main {

let ImgBoss = "\script\MyStuff\MyImg\Game\IkuBoss.png";//Boss Sprite Sheet
let cut = "\img\CutIn_PlayerChar01.png";//Cut In

LoadGraphic(ImgBoss)//Boss Loading

//include functions here
#include_function "script\MyStuff\MyFunctions\MCircle.txt";
#include_function "lib\SHOT_REPLACE\shot_replace.dnh";

//include variables here
let angle = 0;

@Initialize {
SetLife(1900);
SetTime(99);
shotinit;
CutIn(KOUMA, "Dragon Fish"\ ""Dragon Temple of Swimming Bullets"\", cut, 0, 0, 251, 284);
SetMovePosition02(GetCenterX, GetCenterY-100, 120);
Main();
}
@MainLoop {
SetCollisionA(GetX, GetY, 32);
SetCollisionB(GetX, GetY, 16);
yield;
}
@DrawLoop {
Circle;

LoadGraphic(ImgBoss);
SetTexture(ImgBoss);

SetAlpha(255);
SetGraphicScale(1,1);
SetGraphicAngle(0, 0, 0);

SetGraphicRect(0,0,57,72);

if (GetSpeedX()==0){SetGraphicRect(0,0,57,72);;}

else if(GetSpeedX()>0){SetGraphicRect(0,72,48,136);}

else if(GetSpeedX()<0){SetGraphicRect(0,136,48,199);}

DrawGraphic(GetX, GetY);

let BossName="Iku Nagae";
DrawText(BossName, 36, 39, 12, 225);
}
@Finalize {
DeleteGraphic(ImgBoss);
PlaySE("script\MyStuff\MySE\nonfinish.wav");
}
Task Main(){
yield;

loop(240);

loop{
Shot();
loop(360)
SetMovePositionRandom01(60,rand(0,0),3,GetCenterX-100,60,GetCenterX+100,130);
}
}
Task Shot(){
loop(120){
PlaySE("script\Mystuff\MySE\shot1.wav");
CreateShotA(1,GetX-50*cos(angle),GetY-50*sin(angle),10);
SetShotDataA(1,0,4,angle+rand(-3,3),2,-0.04,0,BLUE01);
SetShotDataA(1,80,0,angle,0,0.05,5,BLUE01);
CreateShotA(2,GetX-50*cos(angle-180),GetY-50*sin(angle-180),10);
SetShotDataA(2,0,3,angle-180+rand(-3,3),2,-0.04,0,BLUE01);
SetShotDataA(2,80,0,angle-180,0,0.05,3,YELLOW01);
  FireShot(1);
FireShot(2);

angle += 4;
loop(0.1)
}
}
}
I had a teacher who used to play radiohead during class once.

ONCE.

Re: Danmakufu Q&A/Problem Thread
« Reply #950 on: October 17, 2009, 04:05:14 AM »
Bottom of your script... "loop(0.1)"? Doesn't have opening braces associated with it (you can actually pass decimals in a loop function, that's not the problem). If that doesn't fix it, I'd need those #include_functions to get any farther with the script.

EDIT: Shit shit shit. Few more things. Your #ScriptVersion is 0.01.... Should be 2 (this is what's causing the script to just end). Next you'll get an error on "LoadGraphic", just put the semi-colon after it. Also, put the LoadGraphic in @Initialize. Also also, not an error, but in your @DrawLoop you let BossName = "Iku Nagae"; then immediately use BossName for your DrawText... Why not just have:
Code: [Select]
DrawText("Iku Nagae", 36, 39, 12, 225);

Means the same thing. Just sort of a needless declaration, I guess.
And one last thing, in your task Shot you loop the sound effect along with the bullets. This is completely needless and will cause a fps spike. Take the PlaySE out of the loop and put it either after or before you fire the bullets. You only ever need to play a shot sound once in a frame, any more and it's wasting resources.
« Last Edit: October 17, 2009, 04:21:37 AM by Naut »

Re: Danmakufu Q&A/Problem Thread
« Reply #951 on: October 17, 2009, 04:14:48 AM »
Every function that has "Set" in it's name1 needs only be called once for it to continue running.
I bold so other people get this message as well, since it is important.
1The only exception to this is rule the function SetFog.


So since you "set" the graphic rectangular region to be (0, 0, 256, 256), all images that use that function to determine the graphic rect will use those coordinates until specified otherwise, continuing on to other frames if need be. You do not declare a new graphic rect for the boss, so Danmakufu will use the last one you set, which in this case is your background's.

Okay. But that seems rather strange. If that is the case, then both the boss image and the background would appear 256 by 256 pixels. This does not make much sense to me, if I wanted my boss image to appear naturally. How would I resolve this, then?

Re: Danmakufu Q&A/Problem Thread
« Reply #952 on: October 17, 2009, 04:20:13 AM »
Find the coordinates of your boss image and declare it before drawing the image. It's not as strange as you think, the "Set" part of a function is very useful with other things, like object shots for example.

The reason why you still have to do this even if you want the whole image to appear is because you can keep repeating the image over and over again by selecting a graphic rect larger than the actual image. Think of it as "tiling your background". When you set your desktop background as tiled, then the image keeps repeating itself. That's what happens when you declare out of bounds coordinates.

Cabble

  • Ask me about my Cat.
  • Not unwilling to shank you.
Re: Danmakufu Q&A/Problem Thread
« Reply #953 on: October 17, 2009, 04:23:07 AM »
Bottom of your script... "loop(0.1)"? Doesn't have opening braces associated with it (you can actually pass decimals in a loop function, that's not the problem). If that doesn't fix it, I'd need those #include_functions to get any farther with the script.

EDIT: Shit shit shit. Few more things. Your #ScriptVersion is 0.01.... Should be 2 (this is what's causing the script to just end). Next you'll get an error on "LoadGraphic", just put the semi-colon after it. Also, put the LoadGraphic in @Initialize. Also also, not an error, but in your @DrawLoop you let BossName = "Iku Nagae"; then immediately use BossName for your DrawText... Why not just have:
Code: [Select]
DrawText("Iku Nagae", 36, 39, 12, 225);

Means the same thing. Just sort of a needless declaration, I guess.
And one last thing, in your task Shot you loop the sound effect along with the bullets. This is completely needless and will cause a fps spike. Take the PlaySE out of the loop and put it either after or before you fire the bullets. You only ever need to play a shot sound once in a frame, any more and it's wasting resources.

It still has the same problem after fixing it.

Code: [Select]
#TouhouDanmakufu
#Title[IkuSpell1]
#Text[Water Sign "Electrically Charged Current"]
#Player[FREE]
#ScriptVersion[2]
script_enemy_main {

let ImgBoss = "\script\MyStuff\MyImg\Game\IkuBoss.png";
let cut = "\img\CutIn_PlayerChar01.png";

LoadGraphic(ImgBoss);

//include functions here
#include_function "script\MyStuff\MyFunctions\MCircle.txt";
#include_function "lib\SHOT_REPLACE\shot_replace.dnh";

//include variables here
let angle = 0;

@Initialize {
SetLife(1900);
SetTime(99);
shotinit;
CutIn(KOUMA, "Dragon Fish"\ ""Dragon Temple of Swimming Bullets"\", cut, 0, 0, 251, 284);
SetMovePosition02(GetCenterX, GetCenterY-100, 120);
Main();
}
@MainLoop {
SetCollisionA(GetX, GetY, 32);
SetCollisionB(GetX, GetY, 16);
yield;
}
@DrawLoop {
Circle;

LoadGraphic(ImgBoss);
SetTexture(ImgBoss);

SetAlpha(255);
SetGraphicScale(1,1);
SetGraphicAngle(0, 0, 0);

SetGraphicRect(0,0,57,72);

if (GetSpeedX()==0){SetGraphicRect(0,0,57,72);;}

else if(GetSpeedX()>0){SetGraphicRect(0,72,48,136);}

else if(GetSpeedX()<0){SetGraphicRect(0,136,48,199);}

DrawGraphic(GetX, GetY);

DrawText(IkuNagae, 36, 39, 12, 225);
}
@Finalize {
DeleteGraphic(ImgBoss);
PlaySE("script\MyStuff\MySE\nonfinish.wav");
}
Task Main(){
yield;

loop(240){yield};

loop{
Shot();
loop(360){yield};
SetMovePositionRandom01(60,rand(0,0),3,GetCenterX-100,60,GetCenterX+100,130);
}
}
Task Shot(){
PlaySE("script\Mystuff\MySE\shot1.wav");
loop(120){

CreateShotA(1,GetX-50*cos(angle),GetY-50*sin(angle),10);
SetShotDataA(1,0,4,angle+rand(-3,3),2,-0.04,0,BLUE01);
SetShotDataA(1,80,0,angle,0,0.05,5,BLUE01);
CreateShotA(2,GetX-50*cos(angle-180),GetY-50*sin(angle-180),10);
SetShotDataA(2,0,3,angle-180+rand(-3,3),2,-0.04,0,BLUE01);
SetShotDataA(2,80,0,angle-180,0,0.05,3,YELLOW01);
  FireShot(1);
FireShot(2);

angle += 4;
loop(1){yield}
}
}
}
I had a teacher who used to play radiohead during class once.

ONCE.

Re: Danmakufu Q&A/Problem Thread
« Reply #954 on: October 17, 2009, 04:29:54 AM »
SetTimer(99);, I'm running out of things to look for now!

Re: Danmakufu Q&A/Problem Thread
« Reply #955 on: October 17, 2009, 04:31:05 AM »
Find the coordinates of your boss image and declare it before drawing the image. It's not as strange as you think, the "Set" part of a function is very useful with other things, like object shots for example.

The reason why you still have to do this even if you want the whole image to appear is because you can keep repeating the image over and over again by selecting a graphic rect larger than the actual image. Think of it as "tiling your background". When you set your desktop background as tiled, then the image keeps repeating itself. That's what happens when you declare out of bounds coordinates.

I believe I am very confused by the syntax itself.

What do you mean by coordinates? How would I select these specific coordinates for the boss image?

Can I ask you to provide an example? (I apologize, I am not one who is quick to learn things without very specific details and directions. Visual aid is handy for me, despite how much I want to be able to learn how to fix the problem on my own, this is a situation I find difficult without assistance. I am also an amateur at coding.)

Cabble

  • Ask me about my Cat.
  • Not unwilling to shank you.
Re: Danmakufu Q&A/Problem Thread
« Reply #956 on: October 17, 2009, 04:36:10 AM »
SetTimer(99);, I'm running out of things to look for now!
Still not it.

:((((
I had a teacher who used to play radiohead during class once.

ONCE.

Re: Danmakufu Q&A/Problem Thread
« Reply #957 on: October 17, 2009, 04:43:15 AM »
@Frazer:
You've not read Nuclear Cheese's Drawing Tutorial? I'm sure he does this topic justice better than I'm about to.

SetGraphicRect determines the rectangular region of the graphic (or texture, SetTexture) you want to be displayed. It's parameters are:
SetGraphicRect(the left bound region of the rectangle, the top boundry, the right boundry and the bottom boundry).

So for an image that looks like this:



The GraphicRect would be:
SetGraphicRect(35, 28, 134, 131);


@Shikieiki Ya- Yama- CHEN:
Still looking through it... Give me a minute.
Semi-colon after your loop(1){yield} statement at the bottom of the script, put Iku Nagae in quotation marks in your DrawText function, delete the second semi-colon after your second declaration of SetGraphicRect, de-capitalize the word task for all of your tasks, rename your Main() task to something else (I don't feel comfortable with it named such, probably not a problem though), you can put the PlaySE back inside that loop in the bottom since you're yield;-ing. The only thing here that may actually fix your problem is the "Task" thing, but even that I doubt. This is just stuff you will run in to later anyways, so you might as well fix it. If none of this works, hopefully somebody else can answer this problem for you, I gotta go to bed. Sorry.
« Last Edit: October 17, 2009, 05:01:21 AM by Naut »

Re: Danmakufu Q&A/Problem Thread
« Reply #958 on: October 17, 2009, 04:54:35 AM »
I just took a look through the tutorial (did not think about it before, I might have skimmed through it once before, though).

I know what SetGraphicRect's function is. That is not what I am trying to figure out, though.

In any case, I might have found a possible solution for my problem. I am sorry to have been confusing. Thank you very much.

Re: Danmakufu Q&A/Problem Thread
« Reply #959 on: October 17, 2009, 05:00:21 AM »
Ah, I must have misunderstood your question, my apologies.