Author Topic: ※ Danmakufu Q&A/Problem thread 3 ※  (Read 490469 times)

Sparen

  • Danmakufu Artist
  • Git ready, git set, PUUSH!
    • AFCDTech
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1470 on: August 26, 2018, 07:45:38 PM »
And which function can I use to make the alpha of the boss texture white? (I mean to make the boss all white, but with the opacity)

I recommend taking a render target of the boss, and applying a shader that sets every pixel to your desired color while maintaining the alpha channel value

Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1471 on: August 26, 2018, 07:52:36 PM »
I recommend taking a render target of the boss, and applying a shader that sets every pixel to your desired color while maintaining the alpha channel value
How can I do that?(I don't know about neither shaders nor render targets)

Helepolis

  • Charisma!
  • *
  • O-ojousama!?
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1472 on: August 26, 2018, 08:45:55 PM »
How can I increase playing field's size using camera zoom without changing STG frame?
Not sure if this is possible. There is no "zoom out" for 2D cam afaik.

FlareDragon

  • Gensokyo's Infernal Hellstorm
  • When will you come to Gensokyo, Satsuki Rin?
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1473 on: August 27, 2018, 12:26:42 AM »
How can I increase playing field's size using camera zoom without changing STG frame?
Not sure if this is possible. There is no "zoom out" for 2D cam afaik.
While it is possible to zoom in and out using Set2DCameraRatio (or using Set2DCameraRatioX or Set2DCameraRatioY), it doesn't affect the playing field (I think you'd have to use SetStgFrame somehow). Haven't been able to figure it quite out, but I'm sure it's there somewhere.

EDIT: So I was playing around with it, and I've gotten somewhere with it: Code for zooming task
Biggest issues I'm having so far, though, is it doesn't seem to quite render the frame properly (though the collision is certainly working properly).

Images: Default Zoom(1), Zoomed Out(0.75), Zoomed In(1.2)

Any idea why?
(Also, default collision for shots seem to stop working beyond a certain x- and y-postion, though boss collision definitely works. Seemed interesting enough to note)
« Last Edit: August 27, 2018, 02:30:27 AM by FlareDragon »
Normal 1CC's: SoEW, LLS, MS, EoSD, PCB, IN, PoFV, MoF, SA, UFO, GFW, TD, HM, DDC, ULiL, LoLK(PD), CtC |IaMP|
Hard 1CC's: EoSD, PCB, MoF, IN(B), TD, LoLK(PD), |???|
Lunatic 1CC's: None
Extra 1CC's: SoEW, MS, EoSD, PCB, IN, PoFV, MoF(NB), SA, UFO, GFW, TD, DDC, CtC, LoLK, |???|

Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1474 on: August 27, 2018, 07:25:22 AM »
Maybe with some workarounds and improvements it will work properly? Anyway, thanks for help. And yes, with some workarounds I made 0.7 zoom and it works quite good (no hitbox bugs, just little issues with vision, playable).
https://pastebin.com/t9LPeX8B.
« Last Edit: August 27, 2018, 09:26:22 AM by Alex Renz »

Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1475 on: August 27, 2018, 04:58:23 PM »
There is a tutorial explaining render targets? Where can I found it?

Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1476 on: August 27, 2018, 05:29:20 PM »
There's one here, but it might be outdated now. You don't need to use render targets or shaders for the aura effect at all, just normal 2D sprite objects and the ObjRender_SetColor function.

Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1477 on: August 27, 2018, 05:31:27 PM »
So, I'm trying to implement a continue system. I made a menu appear after pleyer's last life, and after pressing "continue" the game continues, player gets 3 additional lives, but still doesn't revive. It seems that player's state is still at STATE_END and doesn't change even after gaining new lives. What can I do?

Sparen

  • Danmakufu Artist
  • Git ready, git set, PUUSH!
    • AFCDTech
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1478 on: August 27, 2018, 10:07:08 PM »
So, I'm trying to implement a continue system. I made a menu appear after pleyer's last life, and after pressing "continue" the game continues, player gets 3 additional lives, but still doesn't revive. It seems that player's state is still at STATE_END and doesn't change even after gaining new lives. What can I do?

You just never let the player lose all their lives. :)

This is what I do:
Code: [Select]
    case(EV_PLAYER_SHOOTDOWN){ //To disable continue system, block comment this case.
            if(GetPlayerLife < 0){ //If equals 0, still have a life left (IE using last life)
                SetPlayerLife(0.123); //Copied from Arby, should prevent STATE_END.
                ContinueSystem;
            }
    }

Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1479 on: August 28, 2018, 01:29:40 AM »
I've managed to learn how to use render targets, and I need to know if I can transform a black image to a white image (I've set the HSV color 0,0,0 and that make the texture black)

Edit:Nevermind, learned how to make a shader.
« Last Edit: August 28, 2018, 01:54:50 AM by Zinochan »

Drake

  • *
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1480 on: August 28, 2018, 02:53:05 AM »
HSV (0,0,0) is black and (0,0,100) is white.

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

Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1481 on: August 28, 2018, 01:52:18 PM »
Hm, I never thought you can use anything but integers in life value. Thanks for the help

Sparen

  • Danmakufu Artist
  • Git ready, git set, PUUSH!
    • AFCDTech
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1482 on: August 28, 2018, 02:07:31 PM »
Hm, I never thought you can use anything but integers in life value. Thanks for the help

No problem. It's not intuitive, but it works.

Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1483 on: August 28, 2018, 04:18:39 PM »
I've created the aura effect, but now the aura keeps 'escaping' the boss. What can I do to prevent this?
https://pastebin.com/y5jAuUzP
edit:Nevermind again, I was setting the source rect just once.
« Last Edit: August 28, 2018, 04:20:22 PM by Zinochan »

Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1484 on: August 31, 2018, 01:12:42 PM »
How can I receive x and y coordinates of the laser's end?

Sparen

  • Danmakufu Artist
  • Git ready, git set, PUUSH!
    • AFCDTech
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1485 on: August 31, 2018, 01:19:14 PM »
How can I receive x and y coordinates of the laser's end?

One end of the laser is at ObjMove_GetX/Y. The other can be calculated using the length and angle of the laser just as you would do any other radial position calculation: X + length*cos(angle), Y + length*sin(angle).

Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1486 on: September 02, 2018, 01:32:21 PM »
Can someone provide me with a working example of replaye save scene? I tried using the default one without any changes, but after I enter the name of replay and press "done"(or whatever this means 終了) error on the first picture appears. Than I tried to change the default script a bit, and I end up with error on second picture and I don't even know what it means. After some manual change in texts that appear, I managed to surpass that problem (just kinda. I made it go away, but the intended result is also unreachable that way), but the first one still appears after that. Here is my replay save script, which is almost fully copied default version https://pastebin.com/nZBKDhAM

Sparen

  • Danmakufu Artist
  • Git ready, git set, PUUSH!
    • AFCDTech
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1487 on: September 02, 2018, 01:35:52 PM »
Can someone provide me with a working example of replaye save scene? I tried using the default one without any changes, but after I enter the name of replay and press "done"(or whatever this means 終了) error on the first picture appears. Than I tried to change the default script a bit, and I end up with error on second picture and I don't even know what it means. After some manual change in texts that appear, I managed to surpass that problem (just kinda. I made it go away, but the intended result is also unreachable that way), but the first one still appears after that. Here is my replay save script, which is almost fully copied default version https://pastebin.com/nZBKDhAM

I see that you are using "[" and "]"

I recommend escaping these ("[osb]" and "[csb]"? "&osb;" and "&csb;"?) to avoid Danmakufu trying to execute them.

Refer to https://sparen.github.io/ph3tutorials/ph3u2l21.html

Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1488 on: September 04, 2018, 11:12:28 PM »
How can I stop the player from retrying a script with the backspace button?

Kinedyme

  • Dream Magic - Duplex Spark!
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1489 on: September 05, 2018, 02:59:25 AM »
I'm getting some kind of error code on the log window when I try to output calculated values:

1.#INF00 for a number
-1.#IND00 for a different number
1.#QNAN0 for a trigonometric function that essentially takes the sum of the above numbers

What do these warnings mean, and what is likely the problem?

Thanks in advance
« Last Edit: September 05, 2018, 03:02:59 AM by Kinedyme »

Sparen

  • Danmakufu Artist
  • Git ready, git set, PUUSH!
    • AFCDTech
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1490 on: September 05, 2018, 03:01:03 AM »
I'm getting some kind of error code on the log window when I try to output calculated values:

#INF00 for a number
#IND00 for a different number
#QNAN0 for a trigonometric function that essentially takes the sum of the above numbers

What do these warning mean, and what is likely the problem?

Thanks in advance

Please provide the code you are using, the actual error, and more context.

Kinedyme

  • Dream Magic - Duplex Spark!
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1491 on: September 05, 2018, 03:10:20 AM »
Please provide the code you are using, the actual error, and more context.

The first number is intended to be angular acceleration of a bullet, calculated by the function

function CalcAngleAccel1(a1,a2,l1,l2,g,m1,m2,a_v1,a_v2){
      let part1 = -1*g*(2*m1 + m2)*sin(a1);
      let part2 = -1*m2*g*sin(a1 - 2*a2);
      let part3 = -2*sin(a1 - a2)*m2;
      let part4 = a_v2*a_v2*l2 + a_v1*a_v1*l1*cos(a1 - a2);
      let part5 = l1*(2*m1 + m2 - m2*cos(2*a1 - 2*a2));
      let ans = (part1 + part2 + part3*part4)/part5;
      WriteLog(ans);
      return ans;
   }
In which a1 and a2 are a set of angles, a_v1 and a_v2 are those angles' respective angular velocities in the previous frame, and l, g and m are constant variables.

This value is then added to the angular velocity (a_v1), which is then added to the angle (a1).
WriteLog(a1) gives the second value.

The third value is provided by WriteLog(sin(-a1))

The intention is to make a bullet follow a path dictated by polar coordinates using this angle, imitating the movement of a double pendulum. At present, the bullet appears to follow an incorrect path, and then vanish (perhaps moving to (0,0)?) when these errors appear.

Kinedyme

  • Dream Magic - Duplex Spark!
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1492 on: September 05, 2018, 03:14:10 AM »
Oh, and prior to this, the three numbers begin spiralling out of control, with respect to their magnitudes.

The very last frame before these errors appear also returns a value less than -1 for the trigonometric expression as well.

Sparen

  • Danmakufu Artist
  • Git ready, git set, PUUSH!
    • AFCDTech
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1493 on: September 05, 2018, 03:35:25 AM »
EDIT: Oops; read l as |. @Kinedyme: Please use the [ code ] [ / code] tags (no spaces)

I'm getting some kind of error code on the log window when I try to output calculated values:

1.#INF00 for a number
-1.#IND00 for a different number
1.#QNAN0 for a trigonometric function that essentially takes the sum of the above numbers

What do these warnings mean, and what is likely the problem?

Refer to:
https://stackoverflow.com/questions/347920/what-do-1-inf00-1-ind00-and-1-ind-mean
https://stackoverflow.com/questions/29210975/1-qnan0-output-when-calculating-standard-deviation-c
« Last Edit: September 05, 2018, 03:39:29 AM by Sparen »

Kinedyme

  • Dream Magic - Duplex Spark!
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1494 on: September 05, 2018, 03:50:08 AM »
Okay, I'll remember that next time

Thank you, I'll try to add a limit onto the angular acceleration.

Sparen

  • Danmakufu Artist
  • Git ready, git set, PUUSH!
    • AFCDTech
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1495 on: September 05, 2018, 12:40:18 PM »
Okay, I'll remember that next time

Thank you, I'll try to add a limit onto the angular acceleration.

If you angles are the ones exploding, it may help to normalize (angle = angle % 360)

Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1496 on: September 05, 2018, 08:07:56 PM »
I've tried to use variable pointers the way they're used in C/C++ but it doesn't work. Is there any way to use them in Danmakufu?

Drake

  • *
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1497 on: September 05, 2018, 09:30:20 PM »
Definitely not, unfortunately. Objects are not accessed by pointer, but by an integer ID that Danmakufu will then manage internally. Arguments to functions are also passed by value, not by reference.
Are there other particular use cases that you were considering?
« Last Edit: September 05, 2018, 09:34:56 PM by Drake »

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

Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1498 on: September 05, 2018, 09:44:26 PM »
I was thinking of functions that used the variables themselves as parameters, as opposed to the values the variables hold at the time.  For example, I wanted to try to make a "Wait until" function, so instead of writing
Code: [Select]
while(!boolean){yield;}, I'd write
Code: [Select]
WaitUntil(boolean);.
« Last Edit: September 05, 2018, 09:56:22 PM by ArchGaiGar »

Drake

  • *
Re: ※ Danmakufu Q&A/Problem thread 3 ※
« Reply #1499 on: September 05, 2018, 10:36:17 PM »
Yeah, no can do. Technically you can use scope to accomplish this in some sense, i.e.

Code: [Select]
task a(){
  let bool = false;
  function WaitUntilFlag(){
    while(!bool){ yield; }
  }

  task b(){
    // stuff
    bool = true;
  }
  b();

  WaitUntilFlag();

  // finish
}

But that isn't quite the same.

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