Author Topic: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)  (Read 140424 times)

Azure Lazuline

  • Looooove!!
  • PM me for free huggles and love!
    • Entanma Project - indie game development
Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #540 on: September 20, 2011, 12:06:23 AM »
Starting from the top here. You gave no information about how advanced in programming or math you are, so I'm covering it all.

Say that you have two circular objects, and you have a radius defined for each one (r1 and r2). In order to check if they are colliding, you must check the distance between the two object centers. It is easy to see that if the objects are, say, 20 pixels in radius each, and they're less than 40 pixels away from each other, there is a collision. In other words, if the distance between the objects is less than (r1+r2), then they are colliding.

Now, how would you find the distance between two points? All you have are the X and Y coordinates, which don't directly say how far apart. If you paid attention in math class, you probably learned about the Pythagorean Theorem, which states that you can find the hypotenuse of a right triangle if you know the other two sides. In this case, the two sides are the X distance between the objects and the Y distance between the objects, and the hypotenuse is the distance between said objects.

a2 + b2 = c2. A and B are the X and Y distances between the objects, so distance2 = (x1-x2)2 + (y1-y2)2. Converted to Danmakufu code, with two objects obj1 and obj2, and assuming a constant radius:
Code: [Select]
if( (Obj_GetX(obj1)-Obj_GetX(obj2))^2 + (Obj_GetY(obj1)-Obj_GetY(obj2))^2 < radius * radius){
collision stuff here;
}

Assuming you're going to be colliding every bullet with every other bullet, the problem is how to get other bullet IDs in the bullet task. To do this, you put them all into an array (as Mewkyuu said with his very vague and not-explanatory explanation). You might have a global array called bullets (let bullets = [];), and at the beginning of each bullet task after you get its ID (the let obj = Obj_Create(OBJ_SHOT); line), you would put bullets = bullets~obj; to add the bullet ID to the array. In the bullet task, loop through the array and check collision if the bullet ID is less than the current one (so it only checks each pair once, and doesn't check collision with itself).

So then the only thing left to do would be removing the bullet ID from the array if the bullet is deleted. I'm not sure if I need to explain that, but I'd explain it anyway if I wasn't really hungry right now. Hopefully you can handle it from here!
(I probably wrote way too much.)

Final508

  • Danmakufu Beginner
Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #541 on: September 21, 2011, 09:14:36 AM »
This is not being responded on, and then is posted as another one for the lack of popularity of the "Gap Table" theory.
« Last Edit: October 07, 2011, 01:37:32 PM by Final508 »
I mean seriously, Gibberish on a Japanese file? Would anyone think of the source code now?

http://imageshack.us/photo/myimages/684/ohblunderbuss.png

Helepolis

  • Charisma!
  • *
  • O-ojousama!?
Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #542 on: September 21, 2011, 04:54:38 PM »
Here is the code:

http://pastebin.com/C7sFCrTP

EDIT: ( I have no idea with what is happening to this. Again, I say this code is halfway or halfquarter (2.75) still. So I am still finding the solutions for now.
This is just embarrassing to point out what you did wrong. I won't directly help you out unless you insist. Because this is a learning moment for you and people like you.

start reading from script_enemy_main {   and check LINE by LINE. Not just the code, but everything.  If you don't spot your error within 30 seconds. Then just drop a post here and I will point it directly out.

Again this isn't to tease you or to make fun of you. Just to learn you how trial and error precisely.

Edit: Just you also know, once you find the problem (and fix it). It will start giving more errors. And they are also caused by the most simple mistakes which even experts sometimes struggle on.


Edit2:
I'll add it as spoiler below here as I am going to bed. If you don't want to learn or really cannot figure it out, peek here. Or if you managed it, check whether you were correct:
Spoiler:
- You have a } in line 13 which belongs at the end of your script (closing the script enemy main). Because right now it ENDS the script without anything and ignores the rest of the TXT file. Pretty obvious.
- You have a missing ;  at 67 behind Alpha value.
- 'shot' in line 77 is undefined therefore errors.

All of these errors can be tracked by simply looking at the given line code error in the game after you have fixed the } . The } could be discovered by simply counting the opening {  and closing } for each block. You would've instantly run into this because your script is small.
« Last Edit: September 21, 2011, 08:44:22 PM by Helepolis »

TheTeff007

  • Best Touhou 2015!
  • So much cuteness...!
    • Youtube Channel
Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #543 on: September 22, 2011, 01:47:03 AM »
(I probably wrote way too much.)

As long as somebody responds me, you can wrote a book if you want :D

Now seriously, thanks Azure, it really worked, and with Danmakufu my English Math Vocabulary has become beter that it was.

But I have some minor issue here, you see:

Code: [Select]
@MainLoop{

/****************Boss Hitbox****************/
SetDamageRate(10,0);
yield;

/****************Frame Count Initialization*************/
fcount++;

bcount++;
acount++;
/****************Bullets Initialization & Control***************/

if(bcount == 60){
loop(5){
DarkBullet(GetClipMinX,GetCenterY + 100,0.5,0,202,DelayTrack);
WhiteBullet(GetClipMaxX,GetCenterY + 100,0.5,180,201,DelayTrack);
DelayTrack+=120;
}
}

if(acount == 60){
loop(180){
DarkMiniBullet(GetX,GetY,1,dir1,25,60);
WhiteMiniBullet(GetX,GetY,1,dir2,24,120);
dir1+=360/180;
dir2+=360/180;
}
}

//if(bcount == 120){bcount = 0;}
if(acount == 60){acount = -60;}

/****************Effects Initialization******************/


loop(6){if(fcount == Timeout +(60 * Rep)){PlaySE(Time1); Rep+=1;}}
loop(4){if(fcount == Timeout + (60 * Rep)){PlaySE(Time2); Rep+=1;}}

}

The "DarkBullet" and "WhiteBullet" are the bullets that contain the code you gave me, the minibullets are just for Collision detection.

The issue is, each time it loops again the Frame Counter (fcount) the "Dark/WhiteBullet" dissapears and respawns at the location it was set. I'm not sure why this happens...
Small Teaser of my upcoming project~

No need to call me Teff007. Teff will do just as well~

Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #544 on: October 06, 2011, 12:05:48 AM »
So I decided to get into this a bit more and I have some questions:
First, if I've set a variable to ++/-- is there a command I can use to cause it to stop increasing/decreasing?
For example, I have a ring of shots I have set to decrease using "radius--;" and want to stop it decreasing when it reaches 100.

Second, how do I use the boss's life or spellcard timer as a variable, for things such as timeout phases, or adding more bullets as health decreases "Border of Life and Death"-style?
I guess for timeout phases you could just use "if(frame==<value>){raeptime}", but I don't know how you'd change the pattern according to the health.

Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #545 on: October 06, 2011, 06:23:32 AM »
So I decided to get into this a bit more and I have some questions:
First, if I've set a variable to ++/-- is there a command I can use to cause it to stop increasing/decreasing?
For example, I have a ring of shots I have set to decrease using "radius--;" and want to stop it decreasing when it reaches 100.

if(raidus>100){
     radius--;
}

Second, how do I use the boss's life or spellcard timer as a variable, for things such as timeout phases, or adding more bullets as health decreases "Border of Life and Death"-style?
I guess for timeout phases you could just use "if(frame==<value>){raeptime}", but I don't know how you'd change the pattern according to the health.

You can use GetEnemyLife and GetTimer to check how much of either remains.

J.O.B

  • YOU CAN'T MAKE ME CHANGE
Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #546 on: October 06, 2011, 06:28:59 AM »
What do you have to do to the shotsheet to make bullets glow?

Helepolis

  • Charisma!
  • *
  • O-ojousama!?
Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #547 on: October 06, 2011, 07:00:44 AM »
What do you have to do to the shotsheet to make bullets glow?
Well, "glowing" bullets require 2 things:
- Black background, use ADD rendertype (this pretty much goes for most images)
- The bullet is self must have some glowy look (adds to the glowness)

J.O.B

  • YOU CAN'T MAKE ME CHANGE
Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #548 on: October 06, 2011, 07:05:11 AM »
I think I've seen some people use a ring of a colour around the bullet to make it glow but I couldn't get that to work. Do you know how to do that?

Helepolis

  • Charisma!
  • *
  • O-ojousama!?
Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #549 on: October 06, 2011, 08:08:31 AM »
Photoshop?  Really, it is just smart editing the shotsheet and then experimenting until desired effect is achieved. Half of what you see is optical illusion-like tricks.

J.O.B

  • YOU CAN'T MAKE ME CHANGE
Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #550 on: October 06, 2011, 08:26:51 AM »
I see. So I will have to experiment with it then.
Thanks for that Hele.

Final508

  • Danmakufu Beginner
Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #551 on: October 07, 2011, 01:38:06 PM »
I was just trying to improve my circle shots because they disappear when they spawn, However, After deleting the } (that causes it to delete) and add the frame (So they do not shot at the same time), It says there is a problem about script_enemy_main and quickly says CLEAR (This is weird, I thought I already removed the script_enemy_main problem...) while playing, Here is the pastebin code for my stuff:

http://pastebin.com/7tb0eH4L

UPDATE: New pastebin code for new errors upon finding of solution depending on popping errors (Un-translatable Japanese could lead to more unknown errors)
 
« Last Edit: October 07, 2011, 01:52:39 PM by Final508 »
I mean seriously, Gibberish on a Japanese file? Would anyone think of the source code now?

http://imageshack.us/photo/myimages/684/ohblunderbuss.png

Blargel

  • RAWR!
  • I'M AN ANGRY LOLI!
Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #552 on: October 07, 2011, 04:27:55 PM »
I was just trying to improve my circle shots because they disappear when they spawn
Okay.

Quote
However, After deleting the } (that causes it to delete)
....what?

Quote
and add the frame (So they do not shot at the same time)
I don't even know what you mean here.

Quote
It says there is a problem about script_enemy_main and quickly says CLEAR (This is weird, I thought I already removed the script_enemy_main problem...) while playing
Deleting a random } is going to cause that error. You need to have an equal amount of {'s and }'s because they signify when specific blocks of code start and finish.

That said, you're missing a { and a } and your code has a bunch of unnecessary redundant stuff in it. I don't even know where to start with correcting your mistakes. I don't mean this in a mean way; I'm actually asking: How did you learn how to script?
<WorkingKeine> when i get home i just go to the ps3 and beat people up in blazblue with a loli
<Azure> Keine: Danmakufu helper by day, violent loli by night.

Rin Kaenbyou

  • Hell's traffic accident
  • Nyehehehe!
Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #553 on: October 15, 2011, 12:53:06 PM »
2 silly questions:

How to make the screen shake? (as in the last spell of Yuugi)

How I can replicate the Yuugi spell "storm in mt. Ooe"?
Atte: Orin, the most awesome cat (and catgirl)  you ever seen baby!

I love my master Satori, she's so warm and kind... and when I am in her bed with her, she does **** and **** with my precious body... Ahhhh... This feels too good, nyaaaa~
Wait! what are you thinking, pervert? she scratches my chin and pets my back, y-you baka!

Chronojet ⚙ Dragon

  • The Oddity
  • 今コソ輝ケ、我ガ未来、ソノ可能性!!
Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #554 on: October 15, 2011, 02:23:27 PM »
Since this is 0.12m, it's not going to be as easy as "set camera to random shaking" like in ph3.

Welp, the idiot way many people use is just shake the background (like DrawGraphic(x+rand(-10, 10), y+rand(-10, 10); or something.) This doesn't really give a shaking effect if you're really into seeing it, however.

IIRC, the bullets shake even when moving. This is sorta hard, but I think you can make all of the bullets and also the player use custom movement defined in your script. Lemme type up the example.

Here's a very bare skeleton and would not work if you just plain copy it in to your notepad. I expect you to be able to finish up the job. Let me know if you have trouble understanding some of it. (Ugh. Never write code in the morning.)

Storm on Mount Ooe is easy - you just spawn some bullets from the top right corner of the screen. When some of the bullets reach the left border, make them warp over to the right side again. I think that's how they work.
« Last Edit: October 15, 2011, 02:43:31 PM by Konyllis »

Rin Kaenbyou

  • Hell's traffic accident
  • Nyehehehe!
Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #555 on: October 15, 2011, 03:59:55 PM »
Since this is 0.12m, it's not going to be as easy as "set camera to random shaking" like in ph3.

Welp, the idiot way many people use is just shake the background (like DrawGraphic(x+rand(-10, 10), y+rand(-10, 10); or something.) This doesn't really give a shaking effect if you're really into seeing it, however.

IIRC, the bullets shake even when moving. This is sorta hard, but I think you can make all of the bullets and also the player use custom movement defined in your script. Lemme type up the example.

Here's a very bare skeleton and would not work if you just plain copy it in to your notepad. I expect you to be able to finish up the job. Let me know if you have trouble understanding some of it. (Ugh. Never write code in the morning.)

Storm on Mount Ooe is easy - you just spawn some bullets from the top right corner of the screen. When some of the bullets reach the left border, make them warp over to the right side again. I think that's how they work.

Roger. I'll put into practice in my next script, thanks

About Ooeyama, is rare, comes too straight (not random as in the original attack, I'm clumsy as I have said several times, in danmakufu)
Atte: Orin, the most awesome cat (and catgirl)  you ever seen baby!

I love my master Satori, she's so warm and kind... and when I am in her bed with her, she does **** and **** with my precious body... Ahhhh... This feels too good, nyaaaa~
Wait! what are you thinking, pervert? she scratches my chin and pets my back, y-you baka!

Fetch()tirade

  • serial time-waster
Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #556 on: October 19, 2011, 03:31:40 AM »
Is it possible to manually move the player (like SA's Subterranean Sun)? Using a loop with SetPlayerX/Y displays the error message "bad allocation" twice before Danmakufu crashes.

Chronojet ⚙ Dragon

  • The Oddity
  • 今コソ輝ケ、我ガ未来、ソノ可能性!!
Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #557 on: October 19, 2011, 04:13:39 AM »
I'll type it out really quickly.

Code: [Select]
function Gravity(x, y, v) {
let angle = atan2(y-GetPlayerY, x-GetPlayerX);
SetPlayerX(GetPlayerX+v*cos(angle));
SetPlayerY(GetPlayerY+v*sin(angle));
}

run this every frame when you wanna pull the player in to a certain point



http://www.youtube.com/watch?feature=player_detailpage&v=620AB0KPhrM#t=12s
It's demonstrated here, but not very noticeable.
« Last Edit: October 19, 2011, 05:20:49 AM by alt-kyuu-kyuu »

ExPorygon

  • Veteran Danmakufu Scripter
  • Currently working on a full Touhou fangame!
    • Ephemeral Entertainment
Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #558 on: October 19, 2011, 10:20:47 PM »
Is there a way to get a graphic drawn by @DrawLoop to fade out of existence  and then be replaced with another graphic? I've been trying to use this for the fade out and subsequent transition:

Code: [Select]
if(c == true) {
loop(120) { SetAlpha(255-(255/120*x)); x++; yield; }
c = false;
}
if(c == false) {
SetTexture(imgBoss2);
SetRenderState(ALPHA);
SetAlpha(255);
SetGraphicScale(0.35,0.35);
if (int(GetSpeedX())<0) { SetGraphicAngle(180,0,0); } else { SetGraphicAngle(0,0,0); }
SetGraphicRect(0,0,152,175);
DrawGraphic(GetX,GetY);
}
However, it still seems to switch to the next graphic instantaneously instead of fading out. Am I just understanding this wrong?

Drake

  • *
Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #559 on: October 20, 2011, 12:17:08 AM »
What it's doing is looking for other things to yield to, but you're in the DrawLoop so there probably are none. Script returns back to the yield again, hits the closing bracket, loops, repeats the same thing 120 times in one frame. Gets out of the loop, c is now false, changes texture, ends DrawLoop and advances the frame.

Try
Code: [Select]
//initialize x=255; instead
if(x>0) {
SetAlpha(x);
x-=120/255;
}else{
SetTexture(imgBoss2);
SetRenderState(ALPHA);
SetAlpha(255);
SetGraphicScale(0.35,0.35);
if (int(GetSpeedX())<0) { SetGraphicAngle(180,0,0); } else { SetGraphicAngle(0,0,0); }
SetGraphicRect(0,0,152,175);
DrawGraphic(GetX,GetY);
}

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

ExPorygon

  • Veteran Danmakufu Scripter
  • Currently working on a full Touhou fangame!
    • Ephemeral Entertainment
Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #560 on: October 20, 2011, 12:57:07 AM »
What it's doing is looking for other things to yield to, but you're in the DrawLoop so there probably are none. Script returns back to the yield again, hits the closing bracket, loops, repeats the same thing 120 times in one frame. Gets out of the loop, c is now false, changes texture, ends DrawLoop and advances the frame.

That works, thanks for the help!

Yusukeisbestpairing

  • Cookie-liker of all Humankind
  • I like cookies. No seriously.
Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #561 on: October 23, 2011, 01:37:26 PM »
Hey Guys, how do i make my bullets spin clockwise?
(For example: I have a circle of Bullets, and want them to spin around.)

Drake

  • *

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

TheTeff007

  • Best Touhou 2015!
  • So much cuteness...!
    • Youtube Channel
Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #563 on: October 28, 2011, 02:22:13 AM »
Does somebody knows how to replicate Mamizou  Spellcard Background? I don't find a way to replicate it...
Small Teaser of my upcoming project~

No need to call me Teff007. Teff will do just as well~

Drake

  • *
Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #564 on: October 28, 2011, 04:02:41 AM »
It looks like it's warped in a bubble, but I can't seem to figure out how the graphic is actually positioned in there. Note that the white parts of the foreground is a mask that colors/darkens the background.

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

Rosen

  • Cry moar desu!
  • Hyu~ dorodorodoro!
Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #565 on: October 28, 2011, 05:27:36 AM »
I think you can do it with PRIMITIVE_TRIANGLESFAN. Create 360 degrees fan and move source texture rectangle every frame.

Drake

  • *
Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #566 on: October 28, 2011, 06:58:05 AM »
It's less of just one fan as it would be a small fan as the center and then several series of strips around it to form something like an ellipsoid. Like I said, it's more of a warp than mass-vertice editing.

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

Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #567 on: November 01, 2011, 04:25:56 PM »
Hey ther~
I'm new here, so Idk if this is the right place to post this...
Whenever I try to use arisa from CtC in Phantasmagoria trues, I get an error...

Is there any way to fix that and make Marisa a playable character? Thanks a ton for the attention~

Rosen

  • Cry moar desu!
  • Hyu~ dorodorodoro!
Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #568 on: November 01, 2011, 04:49:05 PM »
i think CtC Marisa script uses common data "Score" & "SubRate". Your script doesn't support them. Create common data and enjoy.

Re: ※ Q&A/Problem Thread 5 ※ for OLD Danmakufu version (0.12m)
« Reply #569 on: November 01, 2011, 07:21:45 PM »
Thank you ^^ but... how do I do that? '-'
*newbie*