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

Blargel

  • RAWR!
  • I'M AN ANGRY LOLI!
Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #210 on: October 12, 2012, 01:15:46 AM »
Derp I'm stupid too.
<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.

SusiKette

  • @MainLoop { yield; }
Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #211 on: October 12, 2012, 04:02:26 PM »
EDIT: I got it now so that the bullets will warp once, but the problem is that the (c<1) allows ALL the object bullets to warp that many times so it's a total amount, and when I renew the c value bullets on playfield will warp again and if I don't, newly spawned bullets won't warp. Also updated the code below

Alright, I created an object bullet that when it hits playfield border it comes out from the opposite side. Well... they do come out from the opposite side as I wanted but they do it for forever, I just want it to happen once and on the second time they fly out of the playfield normally. So I need someone to check the part of the script that has the counter.

Code: [Select]
while(!Obj_BeDeleted(obj)) {
if(Obj_GetY(obj) > GetClipMaxY) {
if(c<50) { // there are 50 bullets in one ring, just letting you know
Obj_SetPosition(obj, Obj_GetX(obj), GetClipMinY);
c++;
}
}
yield;
}

I remover the three other playfield collision things to save some space
I tried to use "while" instead of "if" in the "if(c<1) { }" part but it didn't work.
« Last Edit: October 12, 2012, 07:14:30 PM by Yukkuri_Yukkuri_Yukkuri »

Arcorann

  • hey catgirl
  • Surprisingly unkempt
Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #212 on: October 12, 2012, 10:57:55 PM »
You need to declare c as a local variable if you're only using it within each bullet. Try adding the line let c = 0; before your first if statement.

Drake

  • *
Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #213 on: October 13, 2012, 01:05:36 AM »
Mhm. Just in case you don't understand why, what you're doing is creating 50 bullet objects that each have their own warp variables inside the object's task. This way you can check on each one if their warp variable is false, and if so then they can warp. Otherwise they don't warp. Variables you create inside a task or function are valid to call only within that task, so there's no problem with having a bunch of them at once since they all keep track of their own things.


I guess the main thing to understand here is that creating a variable reserves some program memory to be used, and the name you give it lets you access that memory. The variable name itself is mostly helpful for you, it doesn't really have much meaning. As long as you're in different scopes, multiple variables named the same thing are no problem since they won't be defined in the other scope. For example, people naming most of their objects "obj" and yet obviously referencing different objects because they're all in different tasks. But if they're in the same scope (like if they're global variables, or if they're in the same function/task/etc) then setting the variable means you're taking the variable that already exists and giving it a different point in memory to reference, which you might not want.

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

SusiKette

  • @MainLoop { yield; }
Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #214 on: October 13, 2012, 05:03:52 PM »
Seems kind of complicated to make it work properly... maby I'll just keep it the optional way that I ended up using (making the bullets fade delete afted specific time after the warp has occured)

Matteo

Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #215 on: October 13, 2012, 07:54:49 PM »
I have a technical question... i wanted to create a boss, using as sprite both vivit and vivit-angel form from 西方秋霜玉 ~ Shuusou Gyoku.

The problem is that the file that contains the images is not a trasparent image file, it is a paint file with a green background...how can i remove the green background?

Drake

  • *
Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #216 on: October 13, 2012, 08:54:39 PM »
Seems kind of complicated to make it work properly... maby I'll just keep it the optional way that I ended up using (making the bullets fade delete afted specific time after the warp has occured)
Wait what, no no no. That blurb was for informational purposes, sorry if it went way over your head. The change is literally just
Code: [Select]
let c = 0; //initialize the variable inside the task instead of globally
while(!Obj_BeDeleted(obj)) {
if(Obj_GetY(obj) > GetClipMaxY) {
if(c==0) { //if the bullet hasn't warped yet
Obj_SetPosition(obj, Obj_GetX(obj), GetClipMinY);
c++; //bullet has now warped
}
}
yield;
}
And getting rid of the global c variable you were using.


I have a technical question... i wanted to create a boss, using as sprite both vivit and vivit-angel form from 西方秋霜玉 ~ Shuusou Gyoku.

The problem is that the file that contains the images is not a trasparent image file, it is a paint file with a green background...how can i remove the green background?
By doing it yourself in an image editing program that handles transparency. You're lucky that the image doesn't use transparency itself.
http://i.imgur.com/Uwdqu.png
« Last Edit: October 13, 2012, 09:04:09 PM by Drake »

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

Matteo

Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #217 on: October 13, 2012, 09:12:49 PM »
an image editing program that handles transparency?
Mmm, Drake i will try to figure it out, but do you know maybe a program that i can use? Paint is useless and GIMP too. That, or i am doing something wrong. Oh,  thank you! i was really lost

Drake

  • *
Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #218 on: October 13, 2012, 09:29:30 PM »
Paint is useless, but GIMP should handle transparency just fine. You need to add a transparency layer manually if you just open up the image rather than copying it into a new project, though.

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

Matteo

Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #219 on: October 14, 2012, 07:47:37 PM »
ok thx Drake.

Next problem... i'm doing a pattern in which the bullet go zig-zag to the player position:

task start{ loop{
      loop(8){ Bullet(GetX, GetY, 3.2, 45, RED11, 10); Bullet2(GetX, GetY, 3.2, 135, RED11, 10); wait(5); speed += 0.2; }
      wait(90);speed = 0;   }
}

task Bullet(x, y, v, angle, graphic, delay) {
let obj=Obj_Create(OBJ_SHOT);
Obj_SetPosition(obj, x, y);
Obj_SetAngle(obj, angle);
Obj_SetSpeed(obj, v);
ObjShot_SetGraphic(obj, graphic);
ObjShot_SetDelay  (obj, delay);
ObjShot_SetBombResist (obj, true);
wait(30);
Obj_SetAngle(obj,135);
wait(30);
Obj_SetAngle(obj, 45);      
wait(30);
Obj_SetAngle(obj, 135);
wait(30);
Obj_SetAngle(obj,45);      
wait(30);
Obj_SetAngle(obj, 135);
wait(30);
Obj_SetAngle(obj,45 );         
wait(30);
Obj_SetAngle(obj, 135);      
}

task Bullet2(x, y, v, angle, graphic, delay) {
let obj=Obj_Create(OBJ_SHOT);
Obj_SetPosition(obj, x, y);
Obj_SetAngle(obj, angle);
Obj_SetSpeed(obj, v);
ObjShot_SetGraphic(obj, graphic);
ObjShot_SetDelay  (obj, delay);
ObjShot_SetBombResist (obj, true);   
wait(30);
Obj_SetAngle(obj,+45);
wait(30);
Obj_SetAngle(obj, 135);      
wait(30);
Obj_SetAngle(obj, 45);
wait(30);
Obj_SetAngle(obj,135);      
wait(30);
Obj_SetAngle(obj, 45);
wait(30);
Obj_SetAngle(obj,135 );         
wait(30);
Obj_SetAngle(obj, 45);   
}

What i wanted to do was firing bullet1 and 2 to the player position and, using that angle, creating the pattern. So if player is at angle 60, bullet 1 and 2 should fire with angle 60 and then go zig-zag.
But... if i try to use atan2 in obj_setangle, strange things happens... help please.

Delfigamer

  • * Merry, bride, absolute (HR)
  • of course the best girl never wins
Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #220 on: October 15, 2012, 08:42:52 AM »
Trying to understand, what the hell is going here, I rewrited your script that way.
As you see, I wrapped multiple Obj_SetAngle in loop.
Then, I noticed that both tasks are very identical. Both of them crate bullet and periodically sets its angle to (90 +- (-1)^n * 45). We should replace them with one task that will take an extra parameter that will define bullet's direction.
...What's that? Wow, we already have parameter "angle"! And what's its purpose? Though we use it in first Obj_SetAngle; actually we know that in first task it is always set to 45, and in second - to 135; so now it is useless. Let's use this parameter for actual work.
Really, what angle we should use in commented line? I've noticed that 135 = 180 - 45, and 45 = 180 - 135. I know what value I should insert. But do you? Let's leave that for your homework.

Now, let's see what we can do to aim bullet at player's position. I think, we should introduce another variable, holding "player's angle". I hope you know where to insert that code:
Code: [Select]
  let angleOffset = 60;When we'll use it with "angle" in Obj_SetAngle in a certain way (what way? :3), whole zig-zag will turn by "angleOffset" degrees.
I think you now understand what we should place in "offset" instead of this constant value.
Actually, all my Danmakufu knowledge is latest Drake's posts recollection ( * ba dam tss! * ), and it doesn't include getting a direction to player, so let's ask Drake about it.
Drake, how we can get a direction from (X;Y) to player? :3
________

You will never learn how to play on piano without touching black and white keys. Programming, including scripting, is the same.

The Jealous Witch did nothing wrong.

SusiKette

  • @MainLoop { yield; }
Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #221 on: October 15, 2012, 01:32:16 PM »
Wait what, no no no. That blurb was for informational purposes, sorry if it went way over your head. The change is literally just
And getting rid of the global c variable you were using.

I guess I'm not going to edit that script anymore (maby when I'll get the whole plural script done) but I'll save that piece of code for later use if I'll make bullets bounce off the playfield borders :)
Btw, is there a place where you can share your danmakufu scripts or post a video to show others what you are making?

Drake

  • *
Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #222 on: October 15, 2012, 06:24:32 PM »
Youtube for videos, and this forum for sharing scripts, basically. I guess there's http://www.shrinemaiden.org/forum/index.php/topic,2412.0.html too.

You can host finished scripts on http://www.bulletforge.org/ but I don't suggest posting things that are incomplete just for the sake of posting it.



Delfigamer: ph3 made this super easy with an included GetAngleToPlayer(obj) function. 0.12 has a GetAngleToPlayer() function, but it only uses the enemy's position.
In general,
Code: [Select]
function GetAngleToPoint(x1, y1, x2, y2){
   return atan2(y2 - y1, x2 - x1);
}
which becomes
Code: [Select]
function Obj_GetAngleToPlayer(obj){
   return atan2(GetPlayerY - Obj_GetY(obj), GetPlayerX - Obj_GetX(obj));
}
or
Code: [Select]
function GetAngleObjObj(obj1, obj2){
   return atan2(Obj_GetY(obj2) - Obj_GetY(obj1), Obj_GetX(obj2) - Obj_GetX(obj1));
}
The last is also more general and useful in ph3 (using ObjMove_Gets obv) because of pretty much everything being an object.

lol unnecessary detailed trigonometry explanation of atan2: If you have a point on the unit circle with angle t from the zero angle, then sin(t) describes its y-distance relative to the origin and cos(t) describes its x-distance. tan(t) = sin(t) / cos(t) and so is a function of both y-distance and x-distance. But since tan(t) is basically y-dist divided by x-dist, it is a ratio, and so can be equal to the point on any arbitrarily-sized circle with angle t from the zero angle. Using the inverse function of tan (atan) you can then find the angle to the zero angle given the y-distance and x-distance from the origin, or t = atan(y/x). However, if you consider the function atan(y/x), the division is done before the function, so atan(1, 1) will equal atan(-1, -1) which is the opposite angle. So, people developed a function atan2 where you use y and x as parameters. How the above atan2(y2 - y1, x2 - x1) measures the angle from one point to another becomes clear when you set (x1, y1) as (0, 0), which makes it atan2(y2 - 0, x2 - 0) = atan2(y2, x2). Ta da.
« Last Edit: October 15, 2012, 07:26:50 PM by Drake »

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

Delfigamer

  • * Merry, bride, absolute (HR)
  • of course the best girl never wins
Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #223 on: October 16, 2012, 10:44:04 AM »
lol unnecessary detailed trigonometry explanation of atan2: <...>
You forgot to mention that atan(dy,dx) even correctly works when dx=0, while "atan(100/0)" will raise the very funny error. :3

The Jealous Witch did nothing wrong.

Matteo

Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #224 on: October 18, 2012, 05:55:11 AM »
Thank you all for your answers! Still...i don't really understand how to make that pattern i made always aim in the player direction...

but at least now i understand way better the use of atan2!

Delfigamer

  • * Merry, bride, absolute (HR)
  • of course the best girl never wins

The Jealous Witch did nothing wrong.

gtbot

  • Master of ScreenSplit
Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #226 on: October 18, 2012, 11:06:24 AM »
Still...i don't really understand how to make that pattern i made always aim in the player direction...

Here's the code needed for this. With this code, I got rid of the need for two separate tasks. Depending on how you want your zigzags, you can mess around with initialAngle and turnAngle. (For instance, if you want the zigzag to center on the player, or have an angle on the zigzag centered on the player, etc.) But for a recreation of your previous tasks with regard to player angle, use these:

Code: [Select]
Bullet(GetX,GetY, 3.2, GetAngleToPlayer, 90, RED11, 10); //Bullet 1
Bullet(GetX,GetY, 3.2, GetAngleToPlaye+90, -90, RED11, 10); //Bullet 2

Bullet(GetX,GetY, 3.2, GetAngleToPlaye+45, -45, RED11, 10); //Centered Version;
Bullet(GetX,GetY, 3.2, GetAngleToPlaye-45, 45, RED11, 10); //Centered Version;
« Last Edit: October 18, 2012, 11:09:08 AM by gtbot »

Matteo

Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #227 on: October 18, 2012, 12:53:17 PM »
Ok, thank you both Delfigamer and gtbot.

First of all, Delfigamer the errors where: let speed = 3.2 (i needed a ; ) and in the loop(7) obj set position(x,y) was to delete or the bullets after 30 seconds would "teleport" to getx and gety. Am i right? Did i find all?

Oh, thank you for your help, because having a 90% made script in which to find a error forced me to analize all the strings and i learned some useful thing changing those strings.

And gtbot, i modified a bit your sting: task bullet is untouched, but i modified the bullets:

From

 Bullet(GetX,GetY, 3.2, GetAngleToPlaye+45, -45, RED11, 10); //Centered Version;
Bullet(GetX,GetY, 3.2, GetAngleToPlaye-45, 45, RED11, 10); //Centered Version;

i made

Bullet(GetX,GetY, 3.2, GetAngleToPlayer+45, -135, RED11, 0); //Centered Version;
Bullet(GetX,GetY, 3.2, GetAngleToPlayer-45, +135, RED11, 0); //Centered Version;

As you see only turnangle was changed. But i still have a problem. Now i have the pattern that spawn in the player position, but since i do a stream of 7-8 bullets, if the player moves all the bullets take the current player position (that changes because the player is moving). This is ugly to see because all the bullets don't follow in line the pattern...so:

Is there a way to make bullets follow the pattern without changing the direction to the player position? The pattern should start  aiming at player position (atan2 i guess) and from there should zig-zag. What i can't make is make the the pattern to NOT changing angles while it zig-zag.


gtbot

  • Master of ScreenSplit
Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #228 on: October 18, 2012, 01:06:50 PM »
Is there a way to make bullets follow the pattern without changing the direction to the player position? The pattern should start  aiming at player position (atan2 i guess) and from there should zig-zag. What i can't make is make the the pattern to NOT changing angles while it zig-zag.

Right before the loop, add a new variable with GetAngleToPlayer as its value, then use this variable instead of GetAngleToPlayer in the Bullet task. This will preserve the angle from first shot to last shot.

Matteo

Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #229 on: October 18, 2012, 02:23:24 PM »
mmm, now i have:

task start
{
  let fix = GetAngleToPlayer;
   let fix2 = atan2(GetPlayerY-GetY,GetPlayerX-GetX);
  loop
  {   
    loop(8)
    {
     Bullet(GetX,GetY, 3.2, fix2+45, -135, RED11, 0); //Centered Version;
Bullet(GetX,GetY, 3.2, fix2-45, +135, RED11, 0); //Centered Version;
   wait(5);
    }
    wait(90);
  }
}

using fix or fix2 the first pattern aim at player position (let's suppose 60?) , but the starting with the second time the bullets are fired again, the pattern no longer aim at the start to the player position...it keep aiming as the first time (in this example, the first player position , 60). So, now the ugly effect of bullets that each one follow your direction (only if you are moving when the bullets are fired because each one follow the player position) is solved. And that's because with your help gtbot now bullets aim at player only at the start. The only thing i'm trying to fix, and i'm failing, is making all of this loop. Because, as i sadly sayd, the bullet start from the first player position you take at the start of the script and then danmakufu memorize it and use it even if you move around the screen.

Not even SetShotDirectionType(PLAYER); works!   

fondue

  • excuse me
Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #230 on: October 18, 2012, 03:38:52 PM »
That's because fix and fix2 was only declared once. For the bullets to keep aiming at the player "let fix = GetAngleToPlayer;" and "let fix2 = atan2(GetPlayerY-GetY,GetPlayerX-GetX);" have to be declared inside the loop.

Matteo

Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #231 on: October 18, 2012, 04:20:52 PM »
mmm, i don't understand. if i declare  "let fix = GetAngleToPlayer;" and "let fix2 = atan2(GetPlayerY-GetY,GetPlayerX-GetX);"  in my task start , i think that loop or not loop should be indifferent... fix and fix2 exist only in the task , so isn't obvious for danmakufu that each time they do the loop and se "fix" or "fix2" the aim should be set to the player position? Talking in a technical way...why putting "let..." in or out the loop should make difference?

I'm stating that exist a variable fix or fix2, i'm not saying fix/fix2 = (random value) . So even if the "let.." is out the loop, danmakufu should know that fix/fix2 is player position and for each loop this position should update.

But it seems that i'm wrong.

Btw, it works now. Thank you! But still, the "why" it works keep being hard to grasp. Eh...the life of a wannabe scripter that is absolutely awful in math is a hard one
« Last Edit: October 18, 2012, 04:41:04 PM by Matteo »

Blargel

  • RAWR!
  • I'M AN ANGRY LOLI!
Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #232 on: October 18, 2012, 05:38:48 PM »
When you use GetAngleToPlayer or atan2 and assign it to a variable, it takes the angle that it calculates at the time and sticks it in the variable. So for example, at the beginning of your code, when you call let fix = GetAngleToPlayer, let's say that angle is 90 at the time. fix is going to be 90 and always 90. The variable stores the number that the function returns, not the function itself so you need to call it again.
<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.

Matteo

Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #233 on: October 18, 2012, 05:49:41 PM »
Oh...this surely make sense. Thanks Blargel for your explaination

Delfigamer

  • * Merry, bride, absolute (HR)
  • of course the best girl never wins
Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #234 on: October 19, 2012, 08:56:00 AM »
First of all, Delfigamer the errors where: let speed = 3.2 (i needed a ; ) and in the loop(7) obj set position(x,y) was to delete or the bullets after 30 seconds would "teleport" to getx and gety. Am i right? Did i find all?
Parameters of atan2~ Something's going wrong with them~
Talking in a technical way...why putting "let..." in or out the loop should make difference?
D: Operators outside a loop... don't loop. They're executed only once. And wave angle is calculated only once, at the start of the task.

Quote from: Matteo
Having Ran as my personal advisor and maid would be nice i guess.
I Yukari say that she's good maid, but her advices generally are useless. ?∇?
« Last Edit: October 19, 2012, 08:58:05 AM by Delfigamer »

The Jealous Witch did nothing wrong.

Matteo

Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #235 on: October 19, 2012, 03:12:21 PM »
o
« Last Edit: October 19, 2012, 03:16:35 PM by Matteo »

Matteo

Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #236 on: October 19, 2012, 03:15:17 PM »

Ops that's right Delfigamer, now that i notice... let angleOffset = atan2(GetPlayerX - x, GetPlayerY - y); is wrong, in atan2 y is before the x, not after, so the right way is atan2( GetPlayerY - y,GetPlayerX - x); am i right?

And thank you all for your help, so...now i will ask something more, a thing that is puzzling me.

What is the way to make all the different flower patterns that i see in many scripts? I thought that maybe i have to start with a ring of bullets and work with the speed, but i hardly got one of this patterns. Also, i go blindly with tryes, not knowing why i do what i do, so i think that i will have to be lucky to get a flower pattern!

But something keep telling me that i should start with a ring and make or bullets in the ring with different positions (how?) or bullets with different speed (easyer but i'm still trying to understand how to make for example change the speed of the bullet in the ring from 1 to 3 and then again to 1...usually i get or from 1 to 3 or from 3 to 1 only. maybe i should use a while function? But also that, the while thing, is something i still don't understand. Funny that in mainloop i know how to use the "if" but in tasks when i use the "while" usually i throw myself in a infinite loop or simply in an error or more simply...nothing happens because the while function is written bad.)

But returning to the topic of flower patterns... how do you make them? So that i can reproduce it in my way...i'm not asking a code, but if you want to give me an explaination it's surely welcome. Maybe with some examples? I'm the kind of man who needs examples to grasp a concept, not only words.

Thank you.

Quote
I Yukari say that she's good maid, but her advices generally are useless. ?∇?

Why? Poor Ran... if she is a kyuubi no kitsune she at least is 900 years old, so...life should have teached her enough.

fondue

  • excuse me
Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #237 on: October 19, 2012, 04:48:10 PM »
Why? Poor Ran... if she is a kyuubi no kitsune she at least is 900 years old, so...life should have teached her enough.

CORRECTION PLS
She is less than 900 years old. When she reaches that age she starts to lose her tails until she has 4 left then she enters divinity.

Drake

  • *
Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #238 on: October 20, 2012, 05:46:20 AM »
Matteo, what exactly do you mean by a flower pattern? "Flower pattern" doesn't really mean anything, or it could mean a bunch of things.

But for your bullet speed question, if you make a bullet using CreateShotA you can give it the patterns you want.
CreateShotA(0, x, y, delay);
SetShotDataA(0, 0, 1, angle, 0, 0, 0, graphic);
SetShotDataA(0, 60, 3, NULL, 0, 0, 0, graphic);
SetShotDataA(0, 120, 1, NULL, 0, 0, 0, graphic);
FireShot(0);

This will have the bullet fire, then in 60 frames changes its speed to 3, then after another 60 frames change it back to 1. I'm not sure if I'm understanding what you want done exactly, but this would be one solution to your 1-3-1 problem. Another would be to fire the bullet inside a task, wait some frames and change its speed, then wait some more frames and change it back.
« Last Edit: October 20, 2012, 05:54:35 AM by Drake »

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

Arcorann

  • hey catgirl
  • Surprisingly unkempt
Re: ※ Q&A/Problem Thread 6 ※ for OLD Danmakufu version (0.12m)
« Reply #239 on: October 20, 2012, 06:04:36 AM »
If I'm thinking of the right pattern, the trick is to create two sides of the pattern at the same time. I can best explain this with code. Something like this:
ascent(i in 0..10){
CreateShot01(x, y, 1 + 0.1*i, 5 * i, graphic, delay);
CreateShot01(x, y, 1 + 0.1*i, 90 - 5 * i, graphic, delay);
}
This gives 1/4 of a "flower pattern". The speed of the slowest bullets is 1 and the speed of the fastest bullets is 1.9.  Of course, the code needs to be fixed up properly so that we don't get a pair of bullets coinciding on each other.

CORRECTION PLS
She is less than 900 years old. When she reaches that age she starts to lose her tails until she has 4 left then she enters divinity.
Cite your sources or die we'll laugh at you.
« Last Edit: October 20, 2012, 06:59:23 AM by Arcorann »