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

lactose

Re: Danmakufu Q&A/Problem Thread v3
« Reply #180 on: February 14, 2010, 08:38:55 PM »
Code: [Select]
#TouhouDanmakufu
#Title[unknown]
#BGM[.\bgm.mp3]
#Player[FREE]
#ScriptVersion[2]

script_enemy_main
{
 
        let CSD = GetCurrentScriptDirectory;

        let imgBoss = CSD ~ "system\cirno.png";
        let cut = CSD ~ "system\cirnocut.png";
        let bg = CSD ~ "system\lake.png";
     



         @Initialize {
                 SetLife(3000);
                 SetTimer(30);
                 SetScore(50000);
         SetMovePosition01(GetCenterX,GetCenterY,10);
                 LoadGraphic(imgBoss);
                 LoadGraphic(cut);
                 LoadGraphic(bg);

                 CutIn(YOUMU,"Powder storm",cut,0,0,300,384);

         mainTask;

         }

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

         @DrawLoop{       
 
                 // data for the boss
                 SetTexture(imgBoss);   
                 SetRenderState(ALPHA);
                 SetAlpha(255);
                 SetGraphicRect(0,0,110,110);
                 SetGraphicScale(0.7,0.7);
                 SetGraphicAngle(0,0,0);
                 DrawGraphic(GetX,GetY);

         }

         @BackGround{
           
                 SetTexture(bg);   
                 SetRenderState(ALPHA);
                 SetAlpha(255);
                 SetGraphicRect(0,0,512,512);
                 SetGraphicScale(1,1);
                 SetGraphicAngle(0,0,0);
                 DrawGraphic(GetCenterX,GetCenterY);
         }   
     
         @Finalize{
                 // delete the image from memory
                 DeleteGraphic(imgBoss);
                 DeleteGraphic(cut);
                 DeleteGraphic(bg);


         }


         // main task. activates stuff.
         task mainTask{
         yield;
               fire;
         }


         task fire{
                 let x = 0;
                 let dir = 180;
                 loop{
                       while(x<8){
                          superbullet(GetEnemyX,GetEnemyY,3,dir,AQUA01,0);
                          dir+=180/8;
                          x++;
                       }
                       x = 0;
                       dir=180;
                       wait(90);
                       yield;
                 }
        }

         // object bullet task
task superbullet(x,y,v,dir,graphic,delay){
                 let obj = Obj_Create(OBJ_SHOT);

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

                 while(Obj_BeDeleted(obj)==false) {

                         Obj_SetSpeed(obj,0);         // stop the bullet
                         wait(30);                    //wait half second
                         Obj_SetAngle(obj, atan2(GetPlayerY - Obj_GetY(obj), GetPlayerX - obj_GetX9obj)));  // Homes
                         ObjShot_SetGraphic(obj,Aqua23);           // changes graphic
                         Obj_SetSpeed(obj,4);                 // Fires bullets

         yield;
                 }                 
        }
         





         }


     }


It says there's something wrong with the wait function, but I can't find anything wrong? Any ideas.

Iryan

  • Ph?nglui mglw?nafh
  • Cat R?lyeh wgah?nagl fhtagn.
Re: Danmakufu Q&A/Problem Thread v3
« Reply #181 on: February 14, 2010, 08:45:28 PM »
There is no regular wait(); command in danmakufu. You are calling a wait(); function. You didn't define a wait(); function.

What you need is this:

Code: [Select]
function wait(t){
    loop(t){ yield; }
}

Put it somewhere to the variable definitions at the beginning of the script.
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 #182 on: February 16, 2010, 06:42:02 PM »
Trying to load a boss script in a stage file and I get this

---------------------------
ScriptError「C:\Users\Owner\Desktop\Danmakufu\script\Contest 4\Suikamahaha\GeineGoose.txt」
---------------------------
SetLifeが見つかりません
C:\Users\Owner\Desktop\Danmakufu\script\Contest 4\Suikamahaha\sp2heaven.txt(37行目)

         CreateEnemyBossFromFile(GetCurrentScriptDirectory ~ "pluralheaven.txt", 0, 0, 0, 0, 0);

      }

   }



   @BackGround

   {

      //B
~~~
---------------------------
OK   
---------------------------

Boss file works fine by itself

Edit: solved ._.
« Last Edit: February 16, 2010, 06:45:10 PM by Suikama »

Re: Danmakufu Q&A/Problem Thread v3
« Reply #183 on: February 16, 2010, 08:30:42 PM »
I has question, iv'e seen the great dance master Helepolis do it, so I know it is not within the realm of imposibility. How do I draw on top of the default stats? you know on the game frame? And on that note is it possible to erase the side stats? (the fake SA phantasm also did it...somehow) id like to revamp the side bar with stuff like Power, and more updated graphics.

Chronojet ⚙ Dragon

  • The Oddity
  • 今コソ輝ケ、我ガ未来、ソノ可能性!!
Re: Danmakufu Q&A/Problem Thread v3
« Reply #184 on: February 16, 2010, 09:20:43 PM »
And on that note is it possible to erase the side stats?
It's something along the lines of:
Code: (ERASE THE SIDE STATS!!) [Select]
SetDefaultStatusVisible(boolean);

Re: Danmakufu Q&A/Problem Thread v3
« Reply #185 on: February 17, 2010, 04:32:29 AM »
I has question, iv'e seen the great dance master Helepolis do it, so I know it is not within the realm of imposibility. How do I draw on top of the default stats? you know on the game frame? And on that note is it possible to erase the side stats? (the fake SA phantasm also did it...somehow) id like to revamp the side bar with stuff like Power, and more updated graphics.

I don't know how I missed this question for so long but whatever. Using object effects set on layer 8 (ObjEffect_SetLayer(obj, 8 );) will draw above absolutely everything inside the program window. SetDefaultStatusVisible(false); erases all the information on the stg frame (except the fps counter). SetRateScoreSystemEnable(false); gets rids of the default point system that you see in the bottom left corner (it's different from the default stati).
« Last Edit: February 17, 2010, 04:34:07 AM by X-Naut »

Re: Danmakufu Q&A/Problem Thread v3
« Reply #186 on: February 17, 2010, 04:36:04 AM »
I don't know how I missed this question for so long but whatever. Using object effects set on layer 8 (ObjEffect_SetLayer(obj, 8 );) will draw above absolutely everything inside the program window. SetDefaultStatusVisible(false); erases all the information on the stg frame (except the fps counter). SetRateScoreSystemEnable(false); gets rids of the default point system that you see in the bottom left corner (it's different from the default stati).

Oooo~ to think its so simple, I already have a few functions set up to do easy effect objects, im going to have fun with this tomorow~

Re: Danmakufu Q&A/Problem Thread v3
« Reply #187 on: February 17, 2010, 04:37:38 AM »
Oooo~ to think its so simple

Ahh I'm glad I'm not the only person who actually finds most of Danmakufu's workarounds to be somewhat simple :<

Iryan

  • Ph?nglui mglw?nafh
  • Cat R?lyeh wgah?nagl fhtagn.
Re: Danmakufu Q&A/Problem Thread v3
« Reply #188 on: February 17, 2010, 02:23:24 PM »
Hrmmm, interesting....
Annoying... yet interesting...  :/

Apparently when you create a SinuateLaser object and reduce the laser length after the creation beyond a certain value that depends on the width of the laser, the shot graphic rect gets distortet so that you can see the bullet graphics that are next to the actual bullet graphic in the used shot sheet.

What.
« Last Edit: February 17, 2010, 02:31:59 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."

Danmakufu Makeover
« Reply #189 on: February 19, 2010, 01:07:12 AM »
Alright so ive been working on a customized frame setup for my game, I need to use the use of numbers from now on so im gonna need to start changing the built-in graphics, I remember hearing that the built in resources can be modified:

1. how do I change the number fonts with my own? (for score, high score, power, etc)
2. I found a folder that changes the default sounds, where do I put it?
3. Can I remove the floating doilies around the boss?
4. Can I color the health bars? grey feels outdated...

I suppose this thread could also be dedicated to all the others who want to give their danmakufu some flavour too, so feel free to ask your questions too! ^^

Re: Danmakufu Makeover
« Reply #190 on: February 19, 2010, 01:13:28 AM »
The floating squares can be removed by adding MagicCircle(false); in init

Re: Danmakufu Makeover
« Reply #191 on: February 19, 2010, 01:15:25 AM »
The floating squares can be removed by adding MagicCircle(false); in init

That works out great I was planning on using my own circle graphics ^^

Re: Danmakufu Makeover
« Reply #192 on: February 19, 2010, 01:32:51 AM »
1. how do I change the number fonts with my own? (for score, high score, power, etc)

Object effects, layer 8.



2. I found a folder that changes the default sounds, where do I put it?

~\se

3. Can I remove the floating doilies around the boss?

You can edit effect.png for danmakufu and add in your own graphics if you want, but basically requires you to export your own th_dnh.exe folder with your game, since the image will be in a root folder.

4. Can I color the health bars? grey feels outdated...

Build your own, object effects, layer 5 or greater.

Re: Danmakufu Makeover
« Reply #193 on: February 19, 2010, 01:37:45 AM »
Object effects, layer 8.



~\se

You can edit effect.png for danmakufu and add in your own graphics if you want, but basically requires you to export your own th_dnh.exe folder with your game, since the image will be in a root folder.

Build your own, object effects, layer 5 or greater.

Oh I see, I could simply draw over the existing healthbar, one question though, how did you implement ZUN font? is there a simple way of turning your graphics into numbers like that?

Re: Danmakufu Makeover
« Reply #194 on: February 19, 2010, 01:45:36 AM »
No, there is no way to actually change them. You'd have to write your own function to convert numbers to strings and then select and draw images in correspondance.

Re: Danmakufu Makeover
« Reply #195 on: February 19, 2010, 01:53:01 AM »
No, there is no way to actually change them. You'd have to write your own function to convert numbers to strings and then select and draw images in correspondance.

I worried it would end up being that way, new question:

which function converts a number into a string in danmakufu?

Re: Danmakufu Makeover
« Reply #196 on: February 19, 2010, 01:53:32 AM »
No, there is no way to actually change them.
Hooray for danmakufu!

Re: Danmakufu Makeover
« Reply #197 on: February 19, 2010, 01:56:15 AM »
which function converts a number into a string in danmakufu?

ToString(23442);

returns

"23442.000000"

Re: Danmakufu Makeover
« Reply #198 on: February 19, 2010, 01:57:53 AM »
ToString(23442);

returns

"23442.000000"

I suppose theres no easy way to getting only one digit?...unless you devided with 10, 100, 1000, etc, then used the flooring thing, THEN made it string, think that would work?

Re: Danmakufu Makeover
« Reply #199 on: February 19, 2010, 02:03:15 AM »
You can erase elements of a string just like an array. If you don't want six decimal places, just say:

let number = 23442;
number = ToString(number); //"23442.000000"
loop(7){
   number = erase(number, length(number)-1);
}

number now equals "23442".

Also, most of these questions could've gone in the Q&A thread.

Re: Danmakufu Makeover
« Reply #200 on: February 19, 2010, 02:08:03 AM »
You can erase elements of a string just like an array. If you don't want six decimal places, just say:

let number = 23442;
number = ToString(number); //"23442.000000"
loop(7){
   number = erase(number, length(number)-1);
}

number now equals "23442".

that does making it alot cleaner ^^ Okay heres my plan:

1. Make an effect object with an array of 10 numbers
2. Repeat the drawing task for the number of characters in the string, increasing the x drawing value
3. Make it so each seperate digit is put into the right effect using the arrays

id need:

1.a way to get how many characters are in the string
2.a way to get each digit alone so it can pick the right part of the array

Drake

  • *
Re: Danmakufu Makeover
« Reply #201 on: February 19, 2010, 02:09:52 AM »
length(string), and string[n].

go away naut i see you there
« Last Edit: February 19, 2010, 02:16:31 AM by Drake »

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

Re: Danmakufu Makeover
« Reply #202 on: February 19, 2010, 02:21:41 AM »
length(string), and string[n].

go away naut i see you there

so the length is returned in number of characters
and string dooooes...wait theres a function just called string?

Drake

  • *
Re: Danmakufu Makeover
« Reply #203 on: February 19, 2010, 02:22:51 AM »
No, a string is technically just an array of characters. Because of this, you can access the individual characters like you can in an array.
string is just an example variable that contains a string.

string = "apple";
string[4] would equal 'e'.

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

Re: Danmakufu Makeover
« Reply #204 on: February 19, 2010, 02:32:00 AM »
No, a string is technically just an array of characters. Because of this, you can access the individual characters like you can in an array.
string is just an example variable that contains a string.

string = "apple";
string[4] would equal 'e'.

a string is an array!? well mah world is turned upside down =o this opens a few doors though, custom number display system will be my project for tomorow, once I master that, Il be able to finish my customized frame with no problem ^^

Helepolis

  • Charisma!
  • *
  • O-ojousama!?
Re: Danmakufu Q&A/Problem Thread v3
« Reply #205 on: February 19, 2010, 06:55:20 AM »
I don't see a reason to create seperate thread for Q&A-ish question. Merged topics, continue here.

Re: Danmakufu Q&A/Problem Thread v3
« Reply #206 on: February 19, 2010, 06:41:35 PM »
I keep bumping into a new problem, no matter what my number is, using Number[0] for example causes an error, the same error I get if I use a number bigger than the array (I have graphics for 0, 1 and 2 for testing purposes)

if my number is "100"
wouldnt Number[0] give me 1? why doesnt it fit into the effect object's array?

Re: Danmakufu Q&A/Problem Thread v3
« Reply #207 on: February 19, 2010, 07:00:07 PM »
Wait, after testing it some more I noticed the it never gives me a value, I tried it with drawtext and it gives me an error, while regular numbers work just fine, am I supposed to do something with the number afterwards?

Azure Lazuline

  • Looooove!!
  • PM me for free huggles and love!
    • Entanma Project - indie game development
Re: Danmakufu Q&A/Problem Thread v3
« Reply #208 on: February 19, 2010, 08:01:48 PM »
Strings are stored as an array, numbers aren't. In order to get each digit, this is what I did:

Code: [Select]
let num=GetScore;
while(num>0){
  digit=num%10; //get the ones digit

  //do stuff to draw the number to the screen

  num=trunc(num/10);  //divide by ten, so next loop will get the tens digit instead, and so on
}

Re: Danmakufu Q&A/Problem Thread v3
« Reply #209 on: February 19, 2010, 08:17:58 PM »
Strings are stored as an array, numbers aren't. In order to get each digit, this is what I did:

Code: [Select]
let num=GetScore;
while(num>0){
  digit=num%10; //get the ones digit

  //do stuff to draw the number to the screen

  num=trunc(num/10);  //divide by ten, so next loop will get the tens digit instead, and so on
}

Oh Thank Yoooooou!

Iv'e been at it all day messing up my scripts and adding more stuff that didnt work, but now it works and the nightmare is over ^^ your awesome =D