Author Topic: ※ Q&A/Problem Thread 7 ※ for Danmakufu version 0.12m [Closed, read last post!]  (Read 184017 times)

Drake

  • *
Thread 6: http://www.shrinemaiden.org/forum/index.php/topic,12397.0.html

Ask all Danmakufu 0.12m related questions in here.


Please read the Information sticky before posting.
In particular, the various 0.12 tutorials should be helpful.


Please use pastebin.com for large blocks of code.
« Last Edit: April 26, 2016, 06:23:16 PM by Helepolis »

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

Qwertyzxcv

  • yas
  • k!
Re: ※ Q&A/Problem Thread 7 ※ for Danmakufu version 0.12m
« Reply #1 on: June 08, 2013, 03:39:06 AM »
How do I create bullets that start in a circle, and then all go aimed to the player? Like Cirno in EoSD.
« Last Edit: June 08, 2013, 03:03:38 PM by Qwertyzxcv »

LadyScarlet

  • Too lazy to make this a gif right now
  • Still scumming for a good pull
Re: ※ Q&A/Problem Thread 7 ※ for Danmakufu version 0.12m
« Reply #2 on: June 08, 2013, 03:53:44 AM »
I reinstalled Windows 7 recently, and now I can't run Danmakufu. It crashes whenever I open it up. I've set my computer's locale to Japanese and AppLocale installation failed. Help?
My Youtube Channel. I mostly upload Hisoutensoku videos.

Drake

  • *
Re: ※ Q&A/Problem Thread 7 ※ for Danmakufu version 0.12m
« Reply #3 on: June 08, 2013, 04:01:14 AM »
How do I create bullets that start in a circle, and then all go aimed to the player? Like Cirno.
You only need to manipulate CreateShotA(). You set the bullets up first at the boss position, then at 0 frames you fire them at equal speed and increasing angles to fire them in a circle. At 60 frames (or whatever) you change the speed to 0. At 120 frames you change the speed again, and fire them at the player using some standard aiming. I guess the problem is that you need to know where the bullets will stop in order to measure their position, but that's easily done with the same trigonometry you'd use to spawn the bullets in a circle:
x + speed*cos(angle) and y + speed*sin(angle).
Aiming them at the player you could do with atan2() like atan2(y + speed1*sin(angle) - GetPlayerY, x + speed1*cos(angle) - GetPlayerX).

I reinstalled Windows 7 recently, and now I can't run Danmakufu. It crashes whenever I open it up. I've set my computer's locale to Japanese and AppLocale installation failed. Help?
Did the AppLocale installation fail with "There is a problem with this Windows Installer package"? Did you read this thread (linked in the information sticky)? Does DNH crash simply on startup without any message? Please use a bit more detail when asking for technical help.

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

Re: ※ Q&A/Problem Thread 7 ※ for Danmakufu version 0.12m
« Reply #4 on: June 08, 2013, 04:52:33 AM »
How do I create bullets that start in a circle, and then all go aimed to the player? Like Cirno.
You can do what Drake said or use Object bullets which I use.
First spawn the bullets in a circle, which should be the easy part.
In the object bullet task, after a certain amount of time, you should let the bullet stop, usually I use the following to make it smoother:
Code: [Select]
loop(20){ Obj_SetSpeed(obj, Obj_GetSpeed(obj) - 0.1); yield; }Of course this is if the bullets are going at a speed of 2. Change as you need.
Then make the bullet wait another moment and in the moment, change the angle to atan2(Obj_GetY(obj) - GetPlayerY, Obj_GetX(obj) - GetPlayerX );
After that, just add velocity to the bullet and all the bullets should go to the player.
Currently a normal player

Sparen

  • Danmakufu Artist
  • Git ready, git set, PUUSH!
    • AFCDTech
Re: ※ Q&A/Problem Thread 7 ※ for Danmakufu version 0.12m
« Reply #5 on: June 08, 2013, 12:26:01 PM »
Qwerty: You really need to explain in more detail what you are trying to do. Cirno has been a boss in 4+ Touhou games.

Drake

  • *
Re: ※ Q&A/Problem Thread 7 ※ for Danmakufu version 0.12m
« Reply #6 on: June 09, 2013, 12:36:15 AM »
EoSD Cirno's opener.

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

Maths ~Angelic Version~

  • Aspiring Mathematician of Brilliant Laziness
Re: ※ Q&A/Problem Thread 7 ※ for Danmakufu version 0.12m
« Reply #7 on: June 09, 2013, 09:23:26 AM »
How do I create bullets that start in a circle, and then all go aimed to the player? Like Cirno in EoSD.
I assume you mean EoSD Cirno's opener, as Drake said.
Helepolis recreates something similar to it in one of his tutorials.

Darkness1

  • Nothing to see here.
  • Enigmatic, isn't it?
Re: ※ Q&A/Problem Thread 7 ※ for Danmakufu version 0.12m
« Reply #8 on: June 09, 2013, 11:05:28 AM »
Sometimes I wonder why noone uses this method:
Code: [Select]
SetShotDirectionType(PLAYER);
//SetShotDataA code, just set the angle to 0 for the phase to aim at the player.
SetShotDirectionType(ABSOLUTE); //Reset the angle system back to not cause errors later on.
FireShot(ID);
Simple and seems to work fine. This would also apply to using addshot to spawn new bullets aiming at the player from practically any position.
« Last Edit: June 09, 2013, 11:08:17 AM by Darkness1 »

Helepolis

  • Charisma!
  • *
  • O-ojousama!?
Re: ※ Q&A/Problem Thread 7 ※ for Danmakufu version 0.12m
« Reply #9 on: June 09, 2013, 12:08:50 PM »
As far as I know, that one doesn't work when the bullet is not spawned from 0,0 coordinates, which is why you need to use atan2 in order to get the correct angle from bullet to player.

Darkness1

  • Nothing to see here.
  • Enigmatic, isn't it?
Re: ※ Q&A/Problem Thread 7 ※ for Danmakufu version 0.12m
« Reply #10 on: June 09, 2013, 12:14:32 PM »
As far as I know, that one doesn't work when the bullet is not spawned from 0,0 coordinates, which is why you need to use atan2 in order to get the correct angle from bullet to player.
Strange, I have used that method with many different positions and angles and it always worked. On the wiki it says enemy-to-player, but from my tests it seems to work from any position. I may be wrong though.

Qwertyzxcv

  • yas
  • k!
Re: ※ Q&A/Problem Thread 7 ※ for Danmakufu version 0.12m
« Reply #11 on: June 09, 2013, 03:29:22 PM »
Sorry for the late reply, but I have it like this:
Code: [Select]

     while(!Obj_BeDeleted(obj)){
      loop(20){Obj_SetSpeed(obj, Obj_GetSpeed(obj) - 0.1); wait(1);}
      wait(20);
      Obj_SetAngle(obj,atan2(Obj_GetY(obj) - GetPlayerY, Obj_GetX(obj) - GetPlayerX));
      Obj_SetSpeed(obj,3);
     wait(9999999);
   }
Is there something wrong here?
Entire code:
http://pastebin.com/RhmB1Awf
The bullets are aimed away from the player.

Darkness1

  • Nothing to see here.
  • Enigmatic, isn't it?
Re: ※ Q&A/Problem Thread 7 ※ for Danmakufu version 0.12m
« Reply #12 on: June 09, 2013, 03:36:21 PM »
What.
You're using a while loop for looping action while it's not deleted.
You're yielding everywhere.
Try this instead:
Code: [Select]
     let timer = 0;
     while(!Obj_BeDeleted(obj)){
      if(Obj_GetSpeed(obj)==Minspeed){timer++;} //FIXED

      if(Obj_GetSpeed(obj)>Minspeed && timer==0){Obj_SetSpeed(obj, Obj_GetSpeed(obj) - 0.1);} //FIXED

      if(timer==20){
      Obj_SetAngle(obj,atan2(Obj_GetY(obj) - GetPlayerY, Obj_GetX(obj) - GetPlayerX));
      Obj_SetSpeed(obj,3);}

      yield;
   }
This would atleast be more flexible and work better.

Other than that:
dir+=12.25;
Would be causing a bracket error.
« Last Edit: June 09, 2013, 03:55:27 PM by Darkness1 »

Fujiwara no Mokou

  • Hourai Incarnate
  • Oh, so this trial of guts is for ME?
    • Profile
Re: ※ Q&A/Problem Thread 7 ※ for Danmakufu version 0.12m
« Reply #13 on: June 09, 2013, 05:23:38 PM »
I haven't seen this mentioned, so I think I'll add it.
If you make the deceleration linear, it might not come off as very natural. Another option you can take is have the object slow down gradually as it approaches a certain distance.
Here is some pseudocode I haven't tested yet. It's just to throw an idea.

Code: [Select]
let weight = 32;
let speed = 2;
let distance = 50;
let looper = true;

Obj_SetSpeed( obj, speed );
while( looper && !Obj_BeDeleted( obj ) )
{
    if( distance < weight ){
    Obj_SetSpeed( obj, distance / weight * speed );
    yield;
    }
    distance = distance - Obj_GetSpeed( obj );
    if( Obj_GetSpeed( obj ) < 0.5 ){
    looper = false;
    }
}
Obj_SetSpeed( obj, speed );
Obj_SetAngle( obj, atan2( Obj_GetY( obj ) - GetPlayerY(), Obj_GetX( obj ) - GetPlayerX() ) );
while( !Obj_BeDeleted( obj ) )
{
    yield;
}
« Last Edit: June 09, 2013, 05:25:45 PM by Fujiwara no Mokou »

Qwertyzxcv

  • yas
  • k!
Re: ※ Q&A/Problem Thread 7 ※ for Danmakufu version 0.12m
« Reply #14 on: June 09, 2013, 05:50:58 PM »
Thanks all for the suggestions.
Now I have the decceleration all good, but I'm still having problems with the aiming at the player...it's aiming away from the player.

Sparen

  • Danmakufu Artist
  • Git ready, git set, PUUSH!
    • AFCDTech
Re: ※ Q&A/Problem Thread 7 ※ for Danmakufu version 0.12m
« Reply #15 on: June 09, 2013, 06:30:36 PM »
Thanks all for the suggestions.
Now I have the decceleration all good, but I'm still having problems with the aiming at the player...it's aiming away from the player.

Code. Please show us the infected code.

Qwertyzxcv

  • yas
  • k!
Re: ※ Q&A/Problem Thread 7 ※ for Danmakufu version 0.12m
« Reply #16 on: June 09, 2013, 06:46:09 PM »
Code. Please show us the infected code.
I did.

Darkness1

  • Nothing to see here.
  • Enigmatic, isn't it?
Re: ※ Q&A/Problem Thread 7 ※ for Danmakufu version 0.12m
« Reply #17 on: June 09, 2013, 06:53:28 PM »
Thanks all for the suggestions.
Now I have the decceleration all good, but I'm still having problems with the aiming at the player...it's aiming away from the player.
What do you mean? If you mean 180 degrees away from the bossplayer, why not just either:
- put +180 degrees to the atan value in obj_setangle.
- switch the getplayercoordinate functions and Obj_getcoordinate functions around in the atan function.

Whoops, typo.
« Last Edit: June 10, 2013, 05:11:14 AM by Darkness1 »

Qwertyzxcv

  • yas
  • k!
Re: ※ Q&A/Problem Thread 7 ※ for Danmakufu version 0.12m
« Reply #18 on: June 10, 2013, 01:14:06 AM »
What do you mean? If you mean 180 degrees away from the boss, why not just either:
- put +180 degrees to the atan value in obj_setangle.
- switch the getplayercoordinate functions and Obj_getcoordinate functions around in the atan function.
It's aiming 180 degrees away from the player.

Like this?
Code: [Select]
      Obj_SetAngle(obj,atan2(Obj_GetY(obj) - GetPlayerY, Obj_GetX(obj) - GetPlayerX)-180);


Drake

  • *
Re: ※ Q&A/Problem Thread 7 ※ for Danmakufu version 0.12m
« Reply #19 on: June 10, 2013, 01:34:04 AM »
Yeah that would work. Obj_SetAngle(obj, atan2(GetPlayerY - Obj_GetY(obj), GetPlayerX - Obj_GetX(obj))) should suffice as well.

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

Qwertyzxcv

  • yas
  • k!
Re: ※ Q&A/Problem Thread 7 ※ for Danmakufu version 0.12m
« Reply #20 on: June 10, 2013, 02:46:54 PM »
It worked! C: Thanks all!

Sparen

  • Danmakufu Artist
  • Git ready, git set, PUUSH!
    • AFCDTech
Re: ※ Q&A/Problem Thread 7 ※ for Danmakufu version 0.12m
« Reply #21 on: June 15, 2013, 08:25:41 PM »
A not-so-quick question!

Basically, I SetCommonData("Boss", 0); in an enemy script. After that, there is a cutin function (Hele's, altered), and an Enemy Setup task.

The enemy setup task, when using GetCommonData("Boss") successfully returns 0.
The cutin task, on the other hand, states that variables of different types are being compared. The error goes away when I change the comparison value to a string. Of course, that's not the value I want to compare to, and so the default goes instead of what I want.

Help?

Cutin:
Code: [Select]
let CSD = GetCurrentScriptDirectory;
    let textdata = CSD ~ ".\..\system\spellcardanm.png";
    if(GetCommonData("Boss")==0 || GetCommonData("Boss")==1 || GetCommonData("Boss")==6){ //Yellow. Pi, Pika, Jolt
      textdata = CSD ~ ".\..\system\ExAttackYellow.png";
    }
Enemy Setup:
Code: [Select]
  if(GetCommonData("Boss")==0 || GetCommonData("Boss")==1 || GetCommonData("Boss")==6){ //Yellow. Pi, Pika, Jolt
    ascent(i in 0..4){ObjEffect_SetVertexColor(objCirc, i, 150, 255, 255, 255);}
  }

Re: ※ Q&A/Problem Thread 7 ※ for Danmakufu version 0.12m
« Reply #22 on: June 18, 2013, 06:24:40 AM »
I'm planning to make a Touhou fangame called Touhou Kekkannetsu ~ Caliginous Anomaly. The only problem is, I can't get Danmakufu to work correctly, and I don't know any other programs that will help. If I get far enough in the project, I'll release a demo for you.  :V  If anyone could give me some help, either with Danmakufu or finding another program, that would be great.
checkFINISHED checkFINISHED checkFINISHED
checkcheckcheck FINISHEDFINISHEDFINISHED
checkcheckcheckcheckcheckcheckcheckcheck
FINISHEDFINISHEDFINISHEDFINISHEDFINISHEDFINISHEDFINISHEDFINISHED
<Die The death>! <Sentence to death>! <Great equalizer is The Death>!

SacredWind

  • Ordinary Magician
Re: ※ Q&A/Problem Thread 7 ※ for Danmakufu version 0.12m
« Reply #23 on: June 18, 2013, 06:56:03 AM »
You need to run Danmakufu with either Japanese locale or Applocale.

(if you already have did that, then post a pic of the error message)
Nicknames: Sacred, SacredWind.
Touhou Achievements:
Easy 1cc: PCB, SA, UFO
Normal 1cc: IN, MoF, TD

Sparen

  • Danmakufu Artist
  • Git ready, git set, PUUSH!
    • AFCDTech
Re: ※ Q&A/Problem Thread 7 ※ for Danmakufu version 0.12m
« Reply #24 on: June 18, 2013, 01:20:15 PM »
More information about my bug: It only occurs when using Spell Practice. It does not occur when the spell is read from a Plural file or Stage file.

EDIT: Bug fixed

So apparently, if you use CommonData, the initial value of any CommonData is set to a string.
« Last Edit: June 18, 2013, 01:22:03 PM by Sparen »

Drake

  • *
Re: ※ Q&A/Problem Thread 7 ※ for Danmakufu version 0.12m
« Reply #25 on: June 18, 2013, 06:49:17 PM »
Why not use GetCommonDataDefault(), or set defaults to all of your common data on initialization?

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

The Noodles Guy

  • Flip the screen
  • What if Seija met a guy with bipolar disease?
Re: ※ Q&A/Problem Thread 7 ※ for Danmakufu version 0.12m
« Reply #26 on: June 18, 2013, 07:09:37 PM »
How do I make custom STG Frames?

Like CtC's STG Frame.
Easy Modo? That's for kids, and for me.

Drake

  • *
Re: ※ Q&A/Problem Thread 7 ※ for Danmakufu version 0.12m
« Reply #27 on: June 18, 2013, 07:24:08 PM »
-Make image
-Name it STG_Frame.png
-Make an img folder in the DNH root folder
-Plop image in folder

Or you can make an effect and draw it every frame but bleh.

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

Sparen

  • Danmakufu Artist
  • Git ready, git set, PUUSH!
    • AFCDTech
Re: ※ Q&A/Problem Thread 7 ※ for Danmakufu version 0.12m
« Reply #28 on: June 18, 2013, 10:44:26 PM »
How do I make custom STG Frames?

Like CtC's STG Frame.

640*480. If 0.12m, black will be treated as transparent, so make sure that you leave the playing field open or black.

The Noodles Guy

  • Flip the screen
  • What if Seija met a guy with bipolar disease?
Re: ※ Q&A/Problem Thread 7 ※ for Danmakufu version 0.12m
« Reply #29 on: June 19, 2013, 05:52:32 PM »
Thanks Sparen and Drake!
Easy Modo? That's for kids, and for me.