Author Topic: Danmakufu Q&A Thread 4 - V3 Edition.  (Read 18640 times)

0 Members and 1 Guest are viewing this topic.

Re: Danmakufu Q&A Thread 4 - V3 Edition.
« Reply #30 on: August 28, 2020, 10:08:10 AM »
I really dont understand how does sprite sheets work. I mean, i have 2 questions

1: Where can i find them?

i tried the "The sprite recourses" web (https://www.spriters-resource.com/pc_computer/touhoufuujinrokumountainoffaith/sheet/51906/) but in the image appears all the bosses, but i only need 1

2: The coordinates

Is there a way to know the sprite's coordinates to dont make it glitch in battle? (Same problem with shot sheets)

thanks
« Last Edit: August 28, 2020, 10:33:33 AM by ThisIsShort »

Sparen

  • Danmakufu Artist
    • YouTube
    • AFCDTech
  • Gender: Male
Re: Danmakufu Q&A Thread 4 - V3 Edition.
« Reply #31 on: August 28, 2020, 01:19:51 PM »
I really dont understand how does sprite sheets work. I mean, i have 2 questions

1: Where can i find them?

i tried the "The sprite recourses" web (https://www.spriters-resource.com/pc_computer/touhoufuujinrokumountainoffaith/sheet/51906/) but in the image appears all the bosses, but i only need 1

2: The coordinates

Is there a way to know the sprite's coordinates to dont make it glitch in battle? (Same problem with shot sheets)

thanks

1. You already have what you need. Any image editor can crop the image down to the boss you want

2. Most image editors will tell you the coordinates of a given pixel. In addition, in a sprite sheet, most sprites are the same size, so knowing the height and width of the area with the boss sprites is usually enough to determine the dimensions of a single sprite (e.g. width/#sprites)

xChumbo

  • Beginner
    • Twitter
  • Gender: Male
Stage enemies
« Reply #32 on: August 31, 2020, 01:34:17 AM »
Hello, I'm having troubles creating stage enemies; the thing is, I can create the stage enemies well, but is there a way to make the boss wait until the other enemies are defeated? I've tried some solutions by myself but still all the enemies appear with the boss and I can't make it work.


Another doubt I got is: In the StageEnemy creation, there's the following line: "SetDamageRateAtFrameEnm(objEnemy, 80, 50, 30);". This is a function/task that I'm not really sure what it does; the enemies still work but It would be nice if you can tell me its purpose.

Here's some code if you want to see:

Stage code: [ Attachment: You are not allowed to view attachments ]
STGEnemy code: [ Attachment: You are not allowed to view attachments ]

Thank you for your attention.


Sparen

  • Danmakufu Artist
    • YouTube
    • AFCDTech
  • Gender: Male
Re: Stage enemies
« Reply #33 on: September 01, 2020, 01:24:24 PM »
Hello, I'm having troubles creating stage enemies; the thing is, I can create the stage enemies well, but is there a way to make the boss wait until the other enemies are defeated? I've tried some solutions by myself but still all the enemies appear with the boss and I can't make it work.

Personally, I use this function from Ultima:

Code: [Select]
/* *************************************************************************
*void WaitForZeroEnemy() -- Waits for there to be no enemies on screen
************************************************************************* */
function WaitForZeroEnemy(){ //ULTIMA
    while(length(GetAllEnemyID()) > 0){yield;}
}

Skelly

  • Da-da-daisaku Ikeda
  • Gender: Male
Extend function using item points
« Reply #34 on: November 06, 2020, 02:11:35 PM »
Hello, I'm not so new to danmakufu but have stopped messing with it for a while and wanted to warm up again.

Recently I've been working on a simple function in PH3. Basically a function that extends the player whenever it gets a certain amount of points(Like PCB). The major problem I'm having is with the GetPoint function. It basically doesn't work, not returning the actual points collected.

I have tried checking if my function was written wrong. But I have noticed it works using GetGraze instead. I have also noticed that whenever I try to print the number of points collected(Using text functions), it basically doesn't update the actual count(Notice I am calling the function every frame). So I really wonder if the GetPoint function actually works on PH3...

Here is the function I am refering to(I have called it on the stage script btw): https://pastebin.com/cUxjiM2x

(Apologies if the post is messy, it's my first time posting here.)
Airmoto should be Touhou canon

Sparen

  • Danmakufu Artist
    • YouTube
    • AFCDTech
  • Gender: Male
Re: Extend function using item points
« Reply #35 on: November 08, 2020, 02:21:30 PM »
Recently I've been working on a simple function in PH3. Basically a function that extends the player whenever it gets a certain amount of points(Like PCB). The major problem I'm having is with the GetPoint function. It basically doesn't work, not returning the actual points collected.

I have tried checking if my function was written wrong. But I have noticed it works using GetGraze instead. I have also noticed that whenever I try to print the number of points collected(Using text functions), it basically doesn't update the actual count(Notice I am calling the function every frame). So I really wonder if the GetPoint function actually works on PH3...

Here is the function I am refering to(I have called it on the stage script btw): https://pastebin.com/cUxjiM2x

Danmakufu doesn't actually automatically add points - you need to do so manually via AddPoint.

Personally, I would have a task running in the system script that's checking a CommonData value in order to handle extends, and I'd use a CommonData value to track your custom points.

Skelly

  • Da-da-daisaku Ikeda
  • Gender: Male
Re: Extend function using item points
« Reply #36 on: November 11, 2020, 08:58:43 PM »
Danmakufu doesn't actually automatically add points - you need to do so manually via AddPoint.

Personally, I would have a task running in the system script that's checking a CommonData value in order to handle extends, and I'd use a CommonData value to track your custom points.

I see, gonna check your common data tutorials, thanks for the help!
Airmoto should be Touhou canon

Re: Danmakufu Q&A Thread 4 - V3 Edition.
« Reply #37 on: December 19, 2020, 05:29:02 PM »
Hi, i need help with some bullets. I want to make a hammer fall when the other one is deleted, however, i tried it and this is how it ended: https://gyazo.com/8fcff2a6ef204c393af1559907373f65

Here is the whole code for if i did something wrong with the speed or delay: https://pastebin.com/EEULKn2r

Thanks for the help

Microinterval(s)

  • Personification of Microintervals of Dawn
  • a plural system, and an MoD stan
    • Twitch
    • Twitter
    • Microinterval(s)#0721
  • Gender: MoD (it/its/they/them)
Re: Danmakufu Q&A Thread 4 - V3 Edition.
« Reply #38 on: February 05, 2021, 07:29:07 PM »
Hi, i need help with some bullets. I want to make a hammer fall when the other one is deleted, however, i tried it and this is how it ended: https://gyazo.com/8fcff2a6ef204c393af1559907373f65

Here is the whole code for if i did something wrong with the speed or delay: https://pastebin.com/EEULKn2r

Thanks for the help

It's a bit embarrassing replying to such an old topic. Do you still need help?  :cirnotan:

Note that I can't see your gyazo video as the link is invalid. Well, first off, your "move", "fire", and "fire2" tasks don't seem to be used anywhere. I would recommend not keeping unused tasks like these around your code.

Second,
Code: [Select]
ascent(i in 30 .. 3300)
{
if(Obj_IsDeleted(GoldHam)){break;}
let shotSpeed = rand(0.5,1.5);
let sx = ObjMove_GetX(GoldHam);
let sy = ObjMove_GetY(GoldHam);
CreateShotA1(sx, sy - 10, rand(0.5,1.5), rand(0,360), 226, 30);
yield;
}

You don't need an ascent loop for this. You could handle this code with a normal loop. Only use an ascent or descent loop when you need to use the iteration variable that comes with it. (in this case, that would be "i")

Now, I'm a bit confused, but are you trying to fire bullets when GoldHam is deleted? If so, then you will never be able to do this because of the following line:
Code: [Select]
if(Obj_IsDeleted(GoldHam)){break;}
This line of code terminates the loop if GoldHam has been deleted. With this line of code, you'll never be able to spawn bullets because GoldHam is deleted, the loop terminates and shots from firing.

Instead, I would handle this with a "while" loop that runs as long as the GoldHam object has *not* been deleted. In this loop, I will save GoldHam's position to a variable and then "yield;". (if you dont put a yield in an infinite loop, DNH will freeze up as it tries to do infinite things all at once.) The yield also makes DNH stay parsing the loop until the condition becomes false (in this case, until GoldHam is deleted). Meanwhile, there's a reason GoldHam's position has to be saved and updated within this loop. By the time you fire shots, GoldHam has already been deleted. If you try to spawn another object at the X and Y position of an object that does not exist, it will instead spawn at the top left corner of the playing field. Because of this, you will have to save the hammer's last position in the "while" loop. I would do it like so:
Code: [Select]
let sx = 0;
let sy = 0;
while(!Obj_IsDeleted(GoldHam)){
         sx = ObjMove_GetX(GoldHam);
sy = ObjMove_GetY(GoldHam);
         yield;
}
CreateShotA1(sx, sy - 10, rand(0.5,1.5), rand(0,360), 226, 30);

Hopefully this is a clear example, but when GoldHam gets deleted, DNH will stop processing the while loop and will continue to what's directly below. At this point, it will spawn your new shot at the X and Y position GoldHam was at just before it got deleted.

Again, I hope I described this in a way that makes sense. If you still need help, I suggest you join the Bullet Hell Engines Discord server. (https://discord.gg/4wNvvPHxeU)

 
« Last Edit: February 05, 2021, 07:33:40 PM by Luminous_DNH »
3/4 -- just like the signature microintervals of dawn usually has!

Katach314

  • Existence Participation Award-Winner
  • Aren't you that guy who likes masks too much?
  • Gender: Male
Re: Danmakufu Q&A Thread 4 - V3 Edition.
« Reply #39 on: April 21, 2021, 08:57:54 PM »
I have a question pertaining to (what appears to be) a (relatively) popular script, ExPorygon's ZUN Expanded Shotsheet (https://www.bulletforge.org/u/ozzy/p/zun-expanded-shotsheet-for-ph3).

After installing this script, I attempted to use it by #include-ing a specific one of its .txt files (as the readme told me to). However, once I tried to play the script and selected my character, Danmakufu froze for a few seconds and then closed itself.

According to this site (https://sites.google.com/site/sparensdanmakufututorials/dnh-0-12m-tutorials-part-3/014-intro-to-danmakufu-part-4#TOC-ERR-A01:-Danmakufu-crashes), the problem seems to have to do with system locale. However, my locale has been set to Japanese for some time now, so I have no idea what could be causing the problem.

Does anyone know what is causing this problem? (I would prefer not to switch to a different bullet script, as this one seems to be of the highest quality, and... I've already spent an hour or so making a reference sheet for the bullets used by this script.)

EDIT: I tried reverting my script back to when it used the default shots, but it still crashes Danmakufu just before the spell begins for no apparent reason. The part that makes it crash is as follows:

Code: [Select]
task MainTask{
    wait(120);
    while(ObjEnemy_GetInfo(objBoss, INFO_LIFE) > 0){
        let angleT = GetAngleToPlayer(objBoss);
        loop(13) {
CreateShotA1(ObjMove_GetX(objBoss), ObjMove_GetY(objBoss), 2,
angleT, DS_BALL_S_RED, 5);
angleT += 360/13;
}
    }
}

EDIT 2: I found what was causing the crash... I forgot to add a yield in that task. My apologies.
« Last Edit: April 22, 2021, 05:02:56 AM by Katach314 »

PivotLever

Re: Danmakufu Q&A Thread 4 - V3 Edition.
« Reply #40 on: May 07, 2021, 04:07:47 AM »
Hi there! Just started coding in Danmakufu (basically a beginner), got a small Single script going, but I ran into a slight issue. While it may seem simple, I wasn't sure where to ask, so I'll ask here. How would I make a bullet that has gravity (as in, would fall down after a delay when initially shot upwards)? If it's a specific shot function, please direct me to the correct one, or if it requires extra steps, please provide some tips! Given I'm just starting out, I'm not familiar with all of the shot functions yet, so that's why I'm asking. Any help would be greatly appreciated!

Katach314

  • Existence Participation Award-Winner
  • Aren't you that guy who likes masks too much?
  • Gender: Male
Re: Danmakufu Q&A Thread 4 - V3 Edition.
« Reply #41 on: May 12, 2021, 09:38:41 PM »
Try using this (https://sparen.github.io/ph3tutorials/docs_standard.html#fxn_CreateShotA2) function. Have the bullet's Y speed accelerate to create the illusion of falling. Have the X speed decelerate instead so it dips down the longer it's there.

I'm a newbie too! I guess the regulars don't check this thread too often.

EDIT: Wait, I had some questions, too!
  • How does one modify what sprites are used by default system stuff (like the border or the numbers used for the score)? I think the default dnh sprites for the items are grody and wish to replace them with different ones.
  • Are there any scripts that replace the default lifebar system with the ring lifebar system?
  • Same as above, but for a symbol- rather than number-based lives/bullets system? BulletForge doesn't seem to have anything relevant related to either.
« Last Edit: May 12, 2021, 09:54:03 PM by Katach314 »

PivotLever

Re: Danmakufu Q&A Thread 4 - V3 Edition.
« Reply #42 on: May 28, 2021, 09:09:37 PM »
Try using this (https://sparen.github.io/ph3tutorials/docs_standard.html#fxn_CreateShotA2) function. Have the bullet's Y speed accelerate to create the illusion of falling. Have the X speed decelerate instead so it dips down the longer it's there.

I'm a newbie too! I guess the regulars don't check this thread too often.

EDIT: Wait, I had some questions, too!
  • How does one modify what sprites are used by default system stuff (like the border or the numbers used for the score)? I think the default dnh sprites for the items are grody and wish to replace them with different ones.
  • Are there any scripts that replace the default lifebar system with the ring lifebar system?
  • Same as above, but for a symbol- rather than number-based lives/bullets system? BulletForge doesn't seem to have anything relevant related to either.

I never noticed this until now, for some reason  when I set my email notifications, this was set as spam? Thanks, email.

1. To modify the shotsheet, you would need to #include a different one, though you seem to have figured that out in your following message.
2. Not that I know of, you would have to do the coding for that yourself.
3. If you mean life/bomb fragments, that might be included in a HUD of some kind, though I don't know for sure, sorry.

I recommend joining this Discord server if you haven't already, you'll get answers to your questions a lot faster. https://discord.gg/4wNvvPHxeU

Re: Danmakufu Q&A Thread 4 - V3 Edition.
« Reply #43 on: June 16, 2021, 08:50:52 PM »
Not really a question per se, I'm just curious about how menus are generally implemented? How are the animations done and how are things customized?

WishMakers

  • Myouren's IT Guy
  • *
  • Console.WriteLine("h*ck");
    • Twitch
    • Twitter
    • YouTube
    • WishMakers#0385
    • Steam
    • Analogue Reverie Website
  • Gender: Male
Re: Danmakufu Q&A Thread 4 - V3 Edition.
« Reply #44 on: July 23, 2021, 06:24:51 PM »
Not really a question per se, I'm just curious about how menus are generally implemented? How are the animations done and how are things customized?

Basically just a matter of generating render objects and moving them around manually with tasks and stuff.  Sadly in that regard you typically have to do the heavy lifting yourself, but outside of things like smoothing out paths and stuff with interpolation (which ph3sx now has functions for, handily) it's not too bad.  Menu flow is the thing I've found to be trickier and being able to maintain things like state so you can go back to a previous menu without things breaking.
Also known as the Return of Eastern Wonderland and Danmakufu Woo Edition guy.

1ccs: SoEW (N), LLS (N), MS (N), EoSD (H), PCB (N), IN (H), PoFV (N, all shots), MoF (N), SA (N), UFO (N), TD (N), DDC (N), LoLK (N), HSiFS (L), WBaWC (N)
Extra 1ccs: All Windows mainline games, including PoFV.
Scoring: HSiFS Easy (PB: 1.1b)

TouhouLinuxFan

  • TouhouLinuxFan
  • Just a guy who play and make touhou-based games:)
    • raymoe#7381
  • Gender: Male
Replay save scene error on Danmakufu Ph3
« Reply #45 on: September 27, 2021, 05:42:14 PM »
This is a silly error, but I don't know how to fix it. While reading Sparen's Danmakufu tutorials, I came across the replay save scene tutorial. The tutorial said to copy everything from the default replay save scene script to a custom replay save scene script, I did it so. Now, Everytime I go to the replay save scene, danmakufu throws me a weird brackets error, like this one at the picture.

https://imgur.com/MW4g0ln.png



If anyone needs the script, I'll be attaching it here at this topic(even though i'ts identical to the default replay save scene :meiling:)
(Also, don't mind these "squared" texts, it's a WINE error :cirnotan:)


Re: Replay save scene error on Danmakufu Ph3
« Reply #46 on: October 03, 2021, 10:00:22 PM »
Did you try to do exactly what the error says?

Although those "]" ";" or similar missing errors normally are not a thing and the real problem is another thing.

TouhouLinuxFan

  • TouhouLinuxFan
  • Just a guy who play and make touhou-based games:)
    • raymoe#7381
  • Gender: Male
Smooth "ObjRender_SetPosition()"
« Reply #47 on: October 11, 2021, 02:47:43 AM »
Hello once again! I just wanted to ask if someone knows how to smooth out ObjRender_SetPosition(), like with ObjMove_SetDestWithFrame(), etc. Or anything equivalent to "ObjMove_SetDest" that works with ObjRender. Like with this:

(focus on reimu's orb movement)

xChumbo

  • Beginner
    • Twitter
  • Gender: Male
Re: Danmakufu Q&A Thread 4 - V3 Edition.
« Reply #48 on: October 18, 2021, 09:47:47 PM »
Hello guys! I've been thinking a lot about danmakufu scripts, and my question is: Is it posible to render danmakufu scripts/stages/packages outside ph3?

I mean, I've recently seen applications like this one (https://play.google.com/store/apps/details?id=com.knead.TouhouTNA02&hl=es_AR&gl=US), but I don't really know if it's using ph3 or something else to run.

Thank you for your attention.

deice

  • minus mentality
    • 
Re: Danmakufu Q&A Thread 4 - V3 Edition.
« Reply #49 on: October 18, 2021, 10:15:52 PM »
Hello guys! I've been thinking a lot about danmakufu scripts, and my question is: Is it posible to render danmakufu scripts/stages/packages outside ph3?

I mean, I've recently seen applications like this one (https://play.google.com/store/apps/details?id=com.knead.TouhouTNA02&hl=es_AR&gl=US), but I don't really know if it's using ph3 or something else to run.

Thank you for your attention.

while i can't say this with 100% certainty (i don't have the source code) i'm fairly certain thousand night anamnesis is built on it's own engine. this is going by the assumption that building your own DNH interpreter that (presumably) perfectly mimics the original is not only far more difficult, but also far less practical than just writing your own game from scratch

Re: Danmakufu Q&A Thread 4 - V3 Edition.
« Reply #50 on: October 23, 2021, 05:49:44 AM »
Can render priority affect hitboxes? I don't think it should but well...

So, I was messing around with bullets that changed sizes, before realizing that my shrinking bullets completely hid the growing bullets until they were close to the player and led to some cheap deaths.

I used the Obj_SetRenderPriority function to give the growing bullets a priority of 1 and they started behaving... oddly. I'm not 100% sure what was going on, but I was definitely getting killed by invisible hitboxes. I set the priority to 0.6 instead and the problem went away. Any idea what could have possibly caused this?

Additionally, is there a list somewhere of the default render priority of each object?

Thanks!

Tsukasa

  • Actually a white mage?
Re: Danmakufu Q&A Thread 4 - V3 Edition.
« Reply #51 on: October 23, 2021, 06:39:55 AM »
Can render priority affect hitboxes?

Bullets will start rendering with (0,0) being the top left of the window rather than the top left of the playing field.

Maybe that will explain why hitboxes become "wonky" -- they aren't where the bullets seem to be.

WishMakers

  • Myouren's IT Guy
  • *
  • Console.WriteLine("h*ck");
    • Twitch
    • Twitter
    • YouTube
    • WishMakers#0385
    • Steam
    • Analogue Reverie Website
  • Gender: Male
Re: Smooth "ObjRender_SetPosition()"
« Reply #52 on: October 26, 2021, 12:28:33 AM »
You can interpolate it.  A good start would be to do this over multiple frames, like this:
Code: [Select]
task OrbMove(obj,orbx,orby,destx,desty) {
    let sx = orbx;
    let sy = orby;
    let frames = 10; //the amount of frames to move over
    let incr_x = (destx - orbx) / frames;
    let incr_y = (desty - orby) / frames;
    loop(frames) {
        sx += incr_x;
        sy += incr_y;
        ObjRender_SetPosition(obj,sx,sy);
        yield;
    }
}
You can do this in a more refined way, but this is a good starting point.
(Also I noticed you're using 0.12m... you should probably be using ph3.  It's far newer lol)

Also, I realize I'm often not as attentive in here as I should be sometimes, but please keep your questions in the help thread as opposed to making new threads for every question :sweatangry:
For the sake of cleanliness, I'll merge these with the main help thread.
« Last Edit: October 26, 2021, 12:31:28 AM by WishMakers »
Also known as the Return of Eastern Wonderland and Danmakufu Woo Edition guy.

1ccs: SoEW (N), LLS (N), MS (N), EoSD (H), PCB (N), IN (H), PoFV (N, all shots), MoF (N), SA (N), UFO (N), TD (N), DDC (N), LoLK (N), HSiFS (L), WBaWC (N)
Extra 1ccs: All Windows mainline games, including PoFV.
Scoring: HSiFS Easy (PB: 1.1b)

WishMakers

  • Myouren's IT Guy
  • *
  • Console.WriteLine("h*ck");
    • Twitch
    • Twitter
    • YouTube
    • WishMakers#0385
    • Steam
    • Analogue Reverie Website
  • Gender: Male
Re: Danmakufu Q&A Thread 4 - V3 Edition.
« Reply #53 on: October 26, 2021, 12:36:56 AM »
Hello guys! I've been thinking a lot about danmakufu scripts, and my question is: Is it posible to render danmakufu scripts/stages/packages outside ph3?

I mean, I've recently seen applications like this one (https://play.google.com/store/apps/details?id=com.knead.TouhouTNA02&hl=es_AR&gl=US), but I don't really know if it's using ph3 or something else to run.

Thank you for your attention.

A bit delayed but...a couple things.
Firstly, ph3 and its variants only work on PCs for now.  They are designed for Windows and can be used on Mac and Linux using a tool like Wine.
Apps like these are made from scratch and either use their own engines, or use something pre-made like GameMaker:Studio, Unity, Godot, etc.
There are frameworks/sample projects for those if you're interested in making shmup stuff, if you're interested in mobile development.  I'll admit it's not been very explored since the shift in guidelines (which is due for a topic update on the FAQs, come to think of it...)
Also known as the Return of Eastern Wonderland and Danmakufu Woo Edition guy.

1ccs: SoEW (N), LLS (N), MS (N), EoSD (H), PCB (N), IN (H), PoFV (N, all shots), MoF (N), SA (N), UFO (N), TD (N), DDC (N), LoLK (N), HSiFS (L), WBaWC (N)
Extra 1ccs: All Windows mainline games, including PoFV.
Scoring: HSiFS Easy (PB: 1.1b)