Author Topic: ※ Dnh Q&A/Problem thread II ※ for Danmakufu ph3 .1 preX(ry  (Read 240751 times)

Helepolis

  • Charisma!
  • *
  • O-ojousama!?
Welcome to the Question and Answer (or any problem/help me) thread for ph3.
Great lord of Danmakufu, we hit thread number two.


Please post large code in pastebin.com please. Thanks  :)

Helepolis

  • Charisma!
  • *
  • O-ojousama!?
Re: ※ Dnh Q&A/Problem thread II ※ for Danmakufu ph3 .1 preX(ry
« Reply #1 on: March 13, 2014, 09:56:44 PM »
Last 2 posts from previous thread where Kimidori asked a question. Requested by Sparen for additional information in order to assist proper.

It seem like making a nice flight path and shaped danmaku is hard without much knowledge of Geometry and/or Trigonometry. ._.

I still haven't been able to make a flower shaped danmaku without manually placing bullet to draw them out....

Would anyone be so kind to give me a sample code of drawing a flower with math?
Please elaborate on which kind of flower you are looking for. Talos has used flowers before, and polar/parametric equations can easily generate a flower pattern.

Kimidori

  • Undefined Fantastic Girl, Nue
Re: ※ Dnh Q&A/Problem thread II ※ for Danmakufu ph3 .1 preX(ry
« Reply #2 on: March 15, 2014, 03:09:24 PM »
Sorry for the late reply, the flower I want to make is like yuuka 2nd and 3rd spell card in PoFV, without the circle surrounding it, only the petal.


"No matter what, cute is justice. If you're watching shows without moe, you should really be questioning your life decisions. The creation of 2D anime girls is the pinnacle of human achievement." -Logan M

Sparen

  • Danmakufu Artist
  • Git ready, git set, PUUSH!
    • AFCDTech
Re: ※ Dnh Q&A/Problem thread II ※ for Danmakufu ph3 .1 preX(ry
« Reply #3 on: March 15, 2014, 03:43:09 PM »
Sorry for the late reply, the flower I want to make is like yuuka 2nd and 3rd spell card in PoFV, without the circle surrounding it, only the petal.

Use two angle variables, an ascent loop, and a normal loop

ex:

Code: [Select]
task CreateFlowerA1{
    let angle = GetAngleToPlayer(objBoss);
    let angle2 = GetAngleToPlayer(objBoss);
    ascent(i in 0..24){
        loop(6){
            CreateShotA1(ObjMove_GetX(objBoss), ObjMove_GetY(objBoss), 1.5+i/12, angle, <graphic here>, 5);
            CreateShotA1(ObjMove_GetX(objBoss), ObjMove_GetY(objBoss), 1.5+i/12, angle2, <graphic here>, 5);
            angle+=360/6; angle2+=360/6;
        }
        angle+=7;
        angle2-=7;
        wait(3);
    }
}

Helepolis

  • Charisma!
  • *
  • O-ojousama!?
Re: ※ Dnh Q&A/Problem thread II ※ for Danmakufu ph3 .1 preX(ry
« Reply #4 on: March 23, 2014, 01:08:57 PM »
The 'erase' function for arrays is non-existant in ph3, though what is the alternative? The ph3/0.12m list points at 'length' though I am probably missing a vital thinking logic. Current documentation isn't providing insight on this.

I have a set of laser obj ID inside an array upon creation. laserTrackID = laserTrackID ~ [obj]; Basically when the laser disappears, I want the corresponding obj ID to be deleted. However, dumping the entire array is not an option i.e: laserTrackID = [];


Drake

  • *
Re: ※ Dnh Q&A/Problem thread II ※ for Danmakufu ph3 .1 preX(ry
« Reply #5 on: March 23, 2014, 08:30:07 PM »
The 'erase' function for arrays is non-existant in ph3, though what is the alternative? The ph3/0.12m list points at 'length' though I am probably missing a vital thinking logic. Current documentation isn't providing insight on this.

I have a set of laser obj ID inside an array upon creation. laserTrackID = laserTrackID ~ [obj]; Basically when the laser disappears, I want the corresponding obj ID to be deleted. However, dumping the entire array is not an option i.e: laserTrackID = [];
But the erase function still exists.

If you want to define it yourself, it's just a[0..i] ~ a[i+1..length(a)].

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

CK Crash

  • boozer
Re: ※ Dnh Q&A/Problem thread II ※ for Danmakufu ph3 .1 preX(ry
« Reply #6 on: March 24, 2014, 09:08:57 PM »
Just to clarify, even though erase isn't listed on the wiki, it's still in ph3. I guess it went unlisted because it's considered to be in the same class as loop, while, length, etc.

Helepolis

  • Charisma!
  • *
  • O-ojousama!?
Re: ※ Dnh Q&A/Problem thread II ※ for Danmakufu ph3 .1 preX(ry
« Reply #7 on: March 24, 2014, 09:31:03 PM »
You're both right, 'erase' function is still there and managed to get it working as intended, thanks. I'll try to add it tomorrow after some sleep (unless someone goes before me, feel free to)

Edit Done.
« Last Edit: March 25, 2014, 08:09:13 AM by Helepolis »

Re: ※ Dnh Q&A/Problem thread II ※ for Danmakufu ph3 .1 preX(ry
« Reply #8 on: March 27, 2014, 11:05:43 AM »
Hello there, first message and first question.

I'm a week new to Danmakufu (and programming in general) so please bear with any "obvious errors" I might type!
Anyway, I was wondering what does the function "ascent" actually do (somebody posted it before regarding flower pattern bullets and I can't find it on the ph3 functions list on the wiki).
Also, I've been practicing my very first codings with knives bullets and I was wondering:
- does the knives bullets hitbox match the one from the official games? They do feel a little off but it might just be the default Rumia sprite!
- when playing full screen the knives seem to be quite grainy (does this make sense? I mean they seem to be low quality). Is it just me, or maybe it's the lack of a background, or are the bullets sprite actually of lower quality?

I apologize for any spelling and grammatical error I might've made as English isn't my native language.

Helepolis

  • Charisma!
  • *
  • O-ojousama!?
Re: ※ Dnh Q&A/Problem thread II ※ for Danmakufu ph3 .1 preX(ry
« Reply #9 on: March 27, 2014, 03:21:04 PM »
Hello Mege, welcome!

Ascent and descent are light weight loops which can hold a variable (for example here, i) to be performed several times (0..<numberoftimes>).
Code: [Select]
// useful function to 'yield' for given number of frames.
function wait(w) { loop(w) { yield; }

// loop four times using the variable i as the counter. This variable can be called within ascent
ascent(i in 0..4) {
CreateShotA1(bossX,bossY,3,90,i,0);
wait(60);
}
The above would fire a bullet every 60 frames (if we remove wait, it would fire them all at once) for total of four times. The bullet's graphic will be the ID of variable i, which changes every time the ascent loop walks through. Descent will count backwards.

About the knives and grainy looks. I know exactly what you're talking about and I wish I could give you a solid response. I'll await the response from someone who was into the graphical things of 0.12m and ph3. It almost seems Danmakufu stretches the screen and doesn't proper apply image resizing. (Makes me feel as if you're using old mspaint). I do remember that someone told us to try to stick to images being power of 2 --> 32x32  64x64  128x128 etc.
« Last Edit: March 27, 2014, 03:27:53 PM by Helepolis »

Re: ※ Dnh Q&A/Problem thread II ※ for Danmakufu ph3 .1 preX(ry
« Reply #10 on: March 27, 2014, 05:58:40 PM »
Thanks for your response Helepolis, I do tend to get lost in way too many loops so this function might come in handy.
And bummer about the knives, I usually like to play Touhou full screen, I hope somebody has got some tip for it! A side from that, what about the hitbox, does it match the games one by default?

On a (quite) related note, I hope I'm not going to flood this topic too much and I'll try to merge as many questions as possible in single posts, but still, while coding a lot of doubts arise and tutorials can only go as far, compared to somebody actually helping you out. And by the way, I found your videos about ph3 extremely useful, congratulations on that.

Drake

  • *
Re: ※ Dnh Q&A/Problem thread II ※ for Danmakufu ph3 .1 preX(ry
« Reply #11 on: March 27, 2014, 08:09:44 PM »
Could you post a screenshot of the bullets (and if possible a screenshot where you have a background, even if it's the default)? There are a few different things this could be.

In any case, the knife hitboxes will not be the same as they are in the Touhou games. The knife hitboxes in the official games can be wonky anyways, so that might be a good thing lol
« Last Edit: March 27, 2014, 08:11:41 PM by Drake »

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

Re: ※ Dnh Q&A/Problem thread II ※ for Danmakufu ph3 .1 preX(ry
« Reply #12 on: March 27, 2014, 11:29:52 PM »
Could you post a screenshot of the bullets (and if possible a screenshot where you have a background, even if it's the default)? There are a few different things this could be.

In any case, the knife hitboxes will not be the same as they are in the Touhou games. The knife hitboxes in the official games can be wonky anyways, so that might be a good thing lol

Sure thing, here is a screenshot: http://oi58.tinypic.com/r70z9g.jpg
I'm sorry there is no background, I don't know yet how to even add the basic one.
And it's a shame about the hitboxes, the wonkiness was something I actually liked about them, is there any way to make them match the games one? (or at least the sprite size? I feel like the blades are cutting trough me sometimes but the tip doesn't register as a collision. I guess I should find a way to show the player hitbox first to be sure though...).

Thanks in advance.

Re: ※ Dnh Q&A/Problem thread II ※ for Danmakufu ph3 .1 preX(ry
« Reply #13 on: March 28, 2014, 05:35:01 PM »
I'll be direct: I'm trying to make a bullet spawn other bullets as it flies. Pretty simple. I have the code attached, but it only makes a single little bullet appear at when the large one is spawned. What did I do wrong? Here's the code: http://pastebin.com/E1v4TWjj
Normal 1cc's: LLS, MS, EoSD, PCB, IN, MoF, SA, UFO, TD, DDC
Hard 1cc's: EoSD, PCB, IN
Extra Clears: EoSD, PCB + Phantasm, IN, MoF, TD, DDC
Phantasmagoria Trues Clears: Standard Regular
Goals: Phantasmagoria Trues Unseen Standard 1cc, MoF XNM, MoF XNF

Sparen

  • Danmakufu Artist
  • Git ready, git set, PUUSH!
    • AFCDTech
Re: ※ Dnh Q&A/Problem thread II ※ for Danmakufu ph3 .1 preX(ry
« Reply #14 on: March 28, 2014, 07:24:42 PM »
I'll be direct: I'm trying to make a bullet spawn other bullets as it flies. Pretty simple. I have the code attached, but it only makes a single little bullet appear at when the large one is spawned. What did I do wrong? Here's the code: http://pastebin.com/E1v4TWjj

You're drastically overthinking this. Use CreateShotOA1 or CreateShotOA2.

Code: [Select]
    task EruptRing{
          //Deleted code here
  let obj = CreateShotA1(GetEnemyX(objBoss), GetEnemyY(objBoss), 3, angleT, 823, 10);
  ObjShot_SetSpellResist(obj, true);
          //More deleted code
    let objangle = ObjMove_GetAngle(obj);
    loop(8){
      let obj2 = CreateShotOA1(obj, 15, objangle, 226, 5);
      BulletCommands(obj2, dir);
      objangle+=360/8;
    }
          //More deleted code
  wait(20);
        }
    }

This code spawns a bullet that spawns bullets on its position every 20 frames using CreateShotOA1. The loop(8) is because I am spawning 8 bullets on top of the parent bullet.

 let obj2 = CreateShotOA1(obj, 15, objangle, 226, 5);

This creates a new bullet on the location of the bullet whose ID is saved at memory address obj, at speed 15 (it changes later), angle objangle, graphic 226, and delay 5.
« Last Edit: March 28, 2014, 07:26:24 PM by Sparen »

Re: ※ Dnh Q&A/Problem thread II ※ for Danmakufu ph3 .1 preX(ry
« Reply #15 on: March 28, 2014, 07:34:38 PM »
Oh, that looks a lot cleaner. Thanks for the help! Just one thing; what's the deal with the bulletcommands thing?
« Last Edit: March 28, 2014, 07:44:28 PM by Baron_Blade »
Normal 1cc's: LLS, MS, EoSD, PCB, IN, MoF, SA, UFO, TD, DDC
Hard 1cc's: EoSD, PCB, IN
Extra Clears: EoSD, PCB + Phantasm, IN, MoF, TD, DDC
Phantasmagoria Trues Clears: Standard Regular
Goals: Phantasmagoria Trues Unseen Standard 1cc, MoF XNM, MoF XNF

Sparen

  • Danmakufu Artist
  • Git ready, git set, PUUSH!
    • AFCDTech
Re: ※ Dnh Q&A/Problem thread II ※ for Danmakufu ph3 .1 preX(ry
« Reply #16 on: March 28, 2014, 08:27:31 PM »
Oh, that looks a lot cleaner. Thanks for the help! Just one thing; what's the deal with the bulletcommands thing?

Oh, that's just residual code I forgot to remove. I used that to set speed and angular velocity, then wait and change it again. The speed of 15 was to move it a certain distance from the boss.

If you were wondering:

Code: [Select]
    task BulletCommands(obj, dir){
if(ObjEnemy_GetInfo(objBoss, INFO_LIFE) <= 0){return;}//Default kill to prevent (0,0) spawning
ObjMove_SetMaxSpeed(obj, 0);
ObjMove_SetAcceleration(obj, -5); //Will give 3 frames till 0, which is apx. 45 frames away from start location
wait(30);
ObjMove_SetAngularVelocity(obj, 5*dir);
ObjMove_SetSpeed(obj, 1);
wait(60); //Makes 300 degree turn
ObjMove_SetAngularVelocity(obj, 0);
ObjMove_SetMaxSpeed(obj, 2);
ObjMove_SetAcceleration(obj, 0.05);
    }

And yeah, you don't need to create an OBJ_SHOT and do all of that; CreateShotA1 and the like return the object ID for you. This code affects the bullets created on top of the parent bullet only, and is used to control their activity over a number of frames. Dir is spin direction.

Drake

  • *
Re: ※ Dnh Q&A/Problem thread II ※ for Danmakufu ph3 .1 preX(ry
« Reply #17 on: March 29, 2014, 08:23:09 PM »
Sure thing, here is a screenshot: http://oi58.tinypic.com/r70z9g.jpg
I'm sorry there is no background, I don't know yet how to even add the basic one.
Ok so, this isn't unique to your bullets. If you didn't notice, the rest of the screen is also pixelated/aliased. The antialiasing in ph3 just isn't the greatest, and because you're in fullscreen 1440x1080 it looks really pixelated. If your sprites are small and meant for a 640x480 resolution (which is standard), then you're blowing them up to 2.25 times their usual size. You won't be able to fix this really, but if you play windowed at 640x480 you'll see that they look fine.

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

Re: ※ Dnh Q&A/Problem thread II ※ for Danmakufu ph3 .1 preX(ry
« Reply #18 on: March 30, 2014, 09:28:10 AM »
Ok so, this isn't unique to your bullets. If you didn't notice, the rest of the screen is also pixelated/aliased. The antialiasing in ph3 just isn't the greatest, and because you're in fullscreen 1440x1080 it looks really pixelated. If your sprites are small and meant for a 640x480 resolution (which is standard), then you're blowing them up to 2.25 times their usual size. You won't be able to fix this really, but if you play windowed at 640x480 you'll see that they look fine.

Yes I noticed everything gets quite pixelated, definitley a shame but if it can't be helped I guess I'll stick with it, thank you Drake!

I now have another problem. A poster above shared this script for spawning bullets from another flying bullet. After seeing it I tought I'd try to use it to re-create the Sakuya's spellcard from the fighting games (http://img2.wikia.nocookie.net/__cb20100927055435/touhou/images/d/d6/UNL_Sakuyaspell1screenshot.png this one).
So, I managed to have the blue knives fly and leave behind them some grey knives, but I can't get these knives to move at all! I'm probably doing something extremely wrong, and my script will look horrendous to you guys, but after being stuck on this matter for 2 days I'm at a loss!  ???

So here it is: http://pastebin.com/VZNpYYW7

The task I'm talking about is the "eruptingKnives" one.

Sage Ω (Ultima)

  • CEO at Team Eternal Desire
  • ??? X
Re: ※ Dnh Q&A/Problem thread II ※ for Danmakufu ph3 .1 preX(ry
« Reply #19 on: March 30, 2014, 02:15:34 PM »
Yes I noticed everything gets quite pixelated, definitley a shame but if it can't be helped I guess I'll stick with it, thank you Drake!

I now have another problem. A poster above shared this script for spawning bullets from another flying bullet. After seeing it I tought I'd try to use it to re-create the Sakuya's spellcard from the fighting games (http://img2.wikia.nocookie.net/__cb20100927055435/touhou/images/d/d6/UNL_Sakuyaspell1screenshot.png this one).
So, I managed to have the blue knives fly and leave behind them some grey knives, but I can't get these knives to move at all! I'm probably doing something extremely wrong, and my script will look horrendous to you guys, but after being stuck on this matter for 2 days I'm at a loss!  ???

So here it is: http://pastebin.com/VZNpYYW7

The task I'm talking about is the "eruptingKnives" one.


If you want better knife collision then add another "collision = (X,Y,Radius)" to the bullet's ID in the shotsheet. However, if you plan on sharing your scripts, you will need to include the shotsheet with your scripts as well.

Here, I made this which should get you the results you want. You can change the positions and stuff for the main bullet (CreateBulletSpecial)  if you want a different take on the attack.

http://pastebin.com/PU4F8kGN

Also, you don't need to make a angleToPlayer function. Danmakufu has one built in that works. --> GetAngleToPlayer(object);

You also didn't close your script when boss has been deleted (in your end task).

Re: ※ Dnh Q&A/Problem thread II ※ for Danmakufu ph3 .1 preX(ry
« Reply #20 on: March 30, 2014, 05:34:14 PM »
Thank you Infinite, works perfectly!

Re: ※ Dnh Q&A/Problem thread II ※ for Danmakufu ph3 .1 preX(ry
« Reply #21 on: April 01, 2014, 09:06:50 PM »
Is it possible to smoothStep the boss or bullets? How would I go about writing that code?

I did try to do this myself. I made a basic linear movement but that can be done easier using SetAtWeight/SetAtSpeed/SetAccel/etc. When I tried to make a smoothStep, it just jumps to the end destination (or Worse).
Code: [Select]
task smoothStep(obj, x1, y1, t1){
let t0 = 0; // Start Time
while(t0 != t1) {
let x0 = ObjMove_GetX(obj);
let y0 = ObjMove_GetY(obj);
let dT = t0 ^ 2 * (3 - 2 * t0);
let smoothX = x0 + dT * (x1 - x0);
let smoothY = y0 + dT * (y1 - y0);
ObjMove_SetPosition(obj,smoothX,smoothY);
t0 ++;
yield;
}
}
« Last Edit: April 02, 2014, 03:45:23 PM by TheScriptwriter »

CK Crash

  • boozer
Re: ※ Dnh Q&A/Problem thread II ※ for Danmakufu ph3 .1 preX(ry
« Reply #22 on: April 06, 2014, 04:55:49 PM »
I've avoided doing this in the past, but I'm redoing my system files and I want to make sure I get everything right...

  • In a package script, how should I deal with CommonData for stuff that carries over between runs? (settings, Spell History, unlockables)
  • How should I deal with stuff that doesn't carry over? (choosing a certain route unlocks a secret boss later in the run)
  • How do I make stuff from 1) and 2) interact correctly with replays? (Watching a replay with a non-default number of lives works but doesn't change the user's setting, spell history doesn't change when you watch a replay of that spell, etc)

I know that's a lot of stuff to ask, but I don't want to put months into my script before discovering weird replay desynchs and other bugs. I'm aware that the wiki has the functions, but I'm confused about where they actually apply. Ideally, I'd want to have this stuff handled by the End Scene and Replay Scene scripts...
« Last Edit: April 06, 2014, 05:08:08 PM by CK Crash »

Sparen

  • Danmakufu Artist
  • Git ready, git set, PUUSH!
    • AFCDTech
Re: ※ Dnh Q&A/Problem thread II ※ for Danmakufu ph3 .1 preX(ry
« Reply #23 on: April 06, 2014, 07:26:14 PM »
I've avoided doing this in the past, but I'm redoing my system files and I want to make sure I get everything right...

  • In a package script, how should I deal with CommonData for stuff that carries over between runs? (settings, Spell History, unlockables)
  • How should I deal with stuff that doesn't carry over? (choosing a certain route unlocks a secret boss later in the run)
  • How do I make stuff from 1) and 2) interact correctly with replays? (Watching a replay with a non-default number of lives works but doesn't change the user's setting, spell history doesn't change when you watch a replay of that spell, etc)

I know that's a lot of stuff to ask, but I don't want to put months into my script before discovering weird replay desynchs and other bugs. I'm aware that the wiki has the functions, but I'm confused about where they actually apply. Ideally, I'd want to have this stuff handled by the End Scene and Replay Scene scripts...

1: AreaCommonData. Create an AreaCommonData and save it to a file. GT's cut in does this, and both Ozzy's Artifact 1 (I think?) and my DEC demo have examples of the code. (See the config code; it is the clearest)
2: Initialize CommonData in the package and then alter it in the stage. I learned the hard way that if you load one stage and set CommonData in-stage, some of it will be reset when the next stage starts, producing unwanted consequences. I highly recommend initializing all CommonData that is game-specific in the main menu of your package.
3: Replay Comments. Never save CommonData to a replay. After saving it to the replay comment, make sure to initialize the CommonData in your replay save scene, and unload and set CommonData when running a replay in your replay select scene. If you are saving Hi Score, I recommend saving it to an AreaCommonData in the End Scene.

Drake

  • *
Re: ※ Dnh Q&A/Problem thread II ※ for Danmakufu ph3 .1 preX(ry
« Reply #24 on: April 08, 2014, 03:02:18 AM »
Is it possible to smoothStep the boss or bullets? How would I go about writing that code?

I did try to do this myself. I made a basic linear movement but that can be done easier using SetAtWeight/SetAtSpeed/SetAccel/etc. When I tried to make a smoothStep, it just jumps to the end destination (or Worse).
Forgot about this, sorry. You mostly had it right, but you forgot or missed that smoothstep is supposed to bound the interpolated values between 0 and 1. When you increment t0 in your code, it's already 1. To get the smoothstepped value, -2(1)3+3(1)2 = 1, so your delta is 1, then you move to x0 + 1 * (x1 - x0) = x1 and oops you're done already. Notably, if you give smoothstep a value above 1, the squares and cubes will return a larger value than 1. With the input bounded from 0 to 1, you'll return a value between 0 and 1, as intended.
All you need to do instead is have your t0 value go from 0 to 1, so if you want it to last t1 frames, you increase t0 by 1/t1 per frame.

The other problem is just that you were setting a new x0 and y0 every frame. The dT * (x1 - x0) part is your change in x from x0 (origin coordinate), so changing x0 all the time accelerates it and it doesn't work properly (Add back in the x0 = ObjMove_GetX(obj) every frame to see what I mean).

Code: [Select]
task smoothStep(obj, x1, y1, t1){
let t0 = 0; // Start Time
let x0 = ObjMove_GetX(obj); // X-origin
let y0 = ObjMove_GetY(obj); // Y-origin
while(t0 < 1) {
let dT = t0 ^ 2 * (3 - 2 * t0); // Time-delta
let smoothX = x0 + dT * (x1 - x0); // X-origin + X-delta
let smoothY = y0 + dT * (y1 - y0); // Y-origin + Y-delta
ObjMove_SetPosition(obj,smoothX,smoothY);
t0+=1/t1; // Ranges from 0 to 1 over t1 frames
yield;
}
}
« Last Edit: September 10, 2014, 09:47:52 AM by Drake »

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

Re: ※ Dnh Q&A/Problem thread II ※ for Danmakufu ph3 .1 preX(ry
« Reply #25 on: April 10, 2014, 11:27:43 PM »
I'm sorry if this is a stupid question, but I was wondering how to program collisions.
Well, in specific, I'm trying to make it so that if one type of object collides with another type of object, the latter will be deleted.
Does anyone have any advice?

Re: ※ Dnh Q&A/Problem thread II ※ for Danmakufu ph3 .1 preX(ry
« Reply #26 on: April 11, 2014, 08:47:27 PM »
This isn't specific to a code or problem, but I've seen codes where tasks are defined with parameters before the brackets, like this:

task thing (param1,param2,param3,etc) {
       blah
}

What do they mean, usually?
Normal 1cc's: LLS, MS, EoSD, PCB, IN, MoF, SA, UFO, TD, DDC
Hard 1cc's: EoSD, PCB, IN
Extra Clears: EoSD, PCB + Phantasm, IN, MoF, TD, DDC
Phantasmagoria Trues Clears: Standard Regular
Goals: Phantasmagoria Trues Unseen Standard 1cc, MoF XNM, MoF XNF

Sage Ω (Ultima)

  • CEO at Team Eternal Desire
  • ??? X
Re: ※ Dnh Q&A/Problem thread II ※ for Danmakufu ph3 .1 preX(ry
« Reply #27 on: April 11, 2014, 09:13:41 PM »
Those are arguments/variables that can be passed through when the task is called.

task Bullet(x,y,s,a){
let angle = a;
CreateShotA1(x,y,s,angle........
}

Helepolis

  • Charisma!
  • *
  • O-ojousama!?
Re: ※ Dnh Q&A/Problem thread II ※ for Danmakufu ph3 .1 preX(ry
« Reply #28 on: April 11, 2014, 09:35:23 PM »
Edit: GetObjectDistance works for any object, correct by Drake.

I'm sorry if this is a stupid question, but I was wondering how to program collisions.
Well, in specific, I'm trying to make it so that if one type of object collides with another type of object, the latter will be deleted.
Does anyone have any advice?
You can apply if(GetObjectDistance(EffObj1,anyotherObj) < 32) { <deleteDesiredObj> } which will determine whether the obj is within 32 distance from each other.

You can also use, If I am not mistaking: (x2-x1)^2 + (y2-y1)^2 <= (r1+r2)^2   where r = radius. Example: (mind the parentheses, they can be annoying around the ObjMove code.)
Code: [Select]
if( (ObjMove_GetX(obj1) - ObjMove_GetX(obj2))^2 + (ObjMove_GetY(obj1) - ObjMove_GetY(obj2))^2 <= (radius1 + radius2)^2 ) { <deleteDesiredObj> }
Those are arguments/variables that can be passed through when the task is called.

task Bullet(x,y,s,a){
let angle = a;
CreateShotA1(x,y,s,angle........
}
The same can be achieved without declaring angle and just instantly parsing 'a' into the task. I think in this case your example is redundant.
« Last Edit: April 12, 2014, 07:06:31 AM by Helepolis »

Sage Ω (Ultima)

  • CEO at Team Eternal Desire
  • ??? X
Re: ※ Dnh Q&A/Problem thread II ※ for Danmakufu ph3 .1 preX(ry
« Reply #29 on: April 12, 2014, 12:14:16 AM »
The same can be achieved without declaring angle and just instantly parsing 'a' into the task. I think in this case your example is redundant.

That is to demostrate how you can use it. It isn't a question of redundancy; it also gives you an idea of how to somewhat control the information passed through the variable since task/function arguments can't be changed you would insert it into another variable.