Author Topic: Danmakufu Q&A/Problem Thread v3  (Read 213423 times)

Fetch()tirade

  • serial time-waster
Re: Danmakufu Q&A/Problem Thread v3
« Reply #900 on: June 03, 2010, 03:41:21 AM »
Okay thanks. I have no idea what I was thinking, so :colonveeplusalpha:

Azure Lazuline

  • Looooove!!
  • PM me for free huggles and love!
    • Entanma Project - indie game development
Re: Danmakufu Q&A/Problem Thread v3
« Reply #901 on: June 03, 2010, 03:43:07 AM »
there's no such thing as /= :V
/= is a valid symbol, which is why it gave them a weird error. variable/=2  is equivalent to using variable=variable/2, and DMF doesn't like you storing values in a conditional statement.

Kylesky

  • *The Unknown*
  • Local Unbalanced Danmakufu Idiot Scripter
    • My useless youtube account... (will be useful in the future *I promise*)
Re: Danmakufu Q&A/Problem Thread v3
« Reply #902 on: June 03, 2010, 03:46:03 AM »
variable/=2  is equivalent to using variable=variable/2
I had absolutely no idea you could do that :o I thought it was only for += and -=... so I guess there's a *= too?
« Last Edit: June 03, 2010, 03:48:42 AM by Kylesky »
Danmakufu Script Thread :V Latest Script: Intertwining Mechanical Intervention (temp name)

Yooooouuutuuuubeeee Channel Latest Video: Contest #8 Entry

Azure Lazuline

  • Looooove!!
  • PM me for free huggles and love!
    • Entanma Project - indie game development
Re: Danmakufu Q&A/Problem Thread v3
« Reply #903 on: June 03, 2010, 03:55:03 AM »
Yeah, and I think even %= works, but I haven't tested it.

Drake

  • *
Re: Danmakufu Q&A/Problem Thread v3
« Reply #904 on: June 03, 2010, 03:57:45 AM »
Why you would need to use modulus to modify a variable anyways, I haven't the slightest.

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

Re: Danmakufu Q&A/Problem Thread v3
« Reply #905 on: June 03, 2010, 04:03:53 AM »
There is no point in doing it, it will just stay the same, %= does nothing. I just checked

Fetch()tirade

  • serial time-waster
Re: Danmakufu Q&A/Problem Thread v3
« Reply #906 on: June 04, 2010, 11:17:35 PM »
Alright, one more question: I'm gonna have to spoil what I was doing, but I was trying to create an object-shot form of CreateShot02, 11, and 12. The first two worked out, but CreateShot12 took me quite some time.

Code: [Select]
task createshot12objectform(xposition, yposition, xstarting, ystarting, xaccel, yaccel, xminmax, yminmax, graphic, delay){
let shottimer = 0;
let xposorneg = xminmax - xstarting;
let yposorneg = yminmax - ystarting;
let obj = Obj_Create(OBJ_SHOT);
Obj_SetPosition(obj, xposition, yposition);
ObjShot_SetGraphic(obj, graphic);
ObjShot_SetDelay(obj, delay);

while(shottimer >= 0){
let currentx = Obj_GetX(obj);
let currenty = Obj_GetY(obj);
let currentangle = Obj_GetAngle(obj);
let currentlinearspeed = Obj_GetSpeed(obj);
let xcurrentspeed = currentlinearspeed * cos(currentangle);
let ycurrentspeed = currentlinearspeed * sin(currentangle);
let movex;
let movey;

if(xstarting != xminmax){
if(xposorneg < 0){
if(xcurrentspeed > xminmax){movex = xcurrentspeed + xaccel;}
}
if(xposorneg > 0){
if(xcurrentspeed < xminmax){movex = xcurrentspeed + xaccel;}
}
}

if(ystarting != yminmax){
if(yposorneg < 0){
if(ycurrentspeed > yminmax){movey = ycurrentspeed + yaccel;}
}
if(yposorneg > 0){
if(ycurrentspeed < yminmax){movey = ycurrentspeed + yaccel;}
}
}

Obj_SetPosition(obj, currentx + movex, currenty + movey);
shottimer++;
yield;
}
}

It's almost done, except when I load the test script, I get an error about variable substitution on the second Obj_SetPosition. Can someone help?

Re: Danmakufu Q&A/Problem Thread v3
« Reply #907 on: June 05, 2010, 12:15:38 AM »


let movex = 0;
let movey = 0;


solves your problem, you need to set variables to something, such as numbers, strings, arrays, id, etc.  Only when making an object does let something; work

GenericTouhouFailure

  • WHAT DO YOU MEAN IT'S NOT CALLED UNL? *boom*
Re: Danmakufu Q&A/Problem Thread v3
« Reply #908 on: June 05, 2010, 12:26:37 AM »
Could Someone give a hint to how I can make a item script? (You know, "P" for power and custom point items)
Effect Objects?
Enemies?

Re: Danmakufu Q&A/Problem Thread v3
« Reply #909 on: June 05, 2010, 12:41:30 AM »
Can't help you on Item Scripts but,


Here is the link to Nuclear Cheese's Object Effect Tutorial


Making Enemies is just like making bosses, just program some danmaku, have it enter the screen, stay a little bit, then have it move off screen. Then use VanishEnemy; to delete it. Oh, and set the life to something low so it can be destroyed by the player.

Azure Lazuline

  • Looooove!!
  • PM me for free huggles and love!
    • Entanma Project - indie game development
Re: Danmakufu Q&A/Problem Thread v3
« Reply #910 on: June 05, 2010, 12:42:56 AM »
Only when making an object does let something; work

Not true. let something; can work for any variable, with one problem: if you try to use the value before it's assigned anything, it will error for obvious reasons, and this also applies to something++; and the like. Flashtirade's problem was that those variables were getting used for Obj_SetPosition before they were given a value.

Kylesky

  • *The Unknown*
  • Local Unbalanced Danmakufu Idiot Scripter
    • My useless youtube account... (will be useful in the future *I promise*)
Re: Danmakufu Q&A/Problem Thread v3
« Reply #911 on: June 05, 2010, 02:01:35 AM »
Could Someone give a hint to how I can make a item script? (You know, "P" for power and custom point items)
Effect Objects?
Enemies?

Here's the item script to my game... hope it helps... just edit stuff as you see fit... It's not perfected yet, but it shows the basic way to do it... Just call it in @Finalize or something (just make sure that there's something handling it's movement and such, cause it's gonna auto-delete if nothing's controlling it... try making a dummy enemy control it or the main stage script using common datas and such... I added some comments to help you out (the original doesn't have any :V) also, I didn't add the spinning effect yet... You might want to copy-paste the thing into notepad cause it's hard to read here...

*CAUTION* KINDA LONG CODE AHEAD *CAUTION*
Code: [Select]
let itempic="lib\system\items.png";
LoadGraphic(itempic); //Declare and load the graphic used

task itemdrop(type, x, y)
{
let yacc=-5; //so that the item jumps up when spawned like in touhou games
let collection=0; //checks if the item's moving to the player (also used it to control how fast the item's moving toward the player)
let xpos=x;
let ypos=y;
let obj=Obj_Create(OBJ_EFFECT);
ObjEffect_SetTexture(obj, itempic);
ObjEffect_SetPrimitiveType(obj, PRIMITIVE_TRIANGLESTRIP);
ObjEffect_CreateVertex(obj, 4); //declare the effect object
if(type=="POWER_S") //set UV rects... change this depending on the image you're using
{
ObjEffect_SetVertexUV(obj, 0, 0, 0);
ObjEffect_SetVertexUV(obj, 1, 16, 0);
ObjEffect_SetVertexUV(obj, 2, 0, 16);
ObjEffect_SetVertexUV(obj, 3, 16, 16);
}
if(type=="POINT")
{
ObjEffect_SetVertexUV(obj, 0, 16, 0);
ObjEffect_SetVertexUV(obj, 1, 32, 0);
ObjEffect_SetVertexUV(obj, 2, 16, 16);
ObjEffect_SetVertexUV(obj, 3, 32, 16);
}
if(type=="COLLECT") //Collect's just some extra item for my game :V
{
ObjEffect_SetVertexUV(obj, 0, 112, 0);
ObjEffect_SetVertexUV(obj, 1, 128, 0);
ObjEffect_SetVertexUV(obj, 2, 112, 16);
ObjEffect_SetVertexUV(obj, 3, 128, 16);
}
if(type=="COLLECT_L")
{
ObjEffect_SetVertexUV(obj, 0, 32, 0);
ObjEffect_SetVertexUV(obj, 1, 48, 0);
ObjEffect_SetVertexUV(obj, 2, 32, 16);
ObjEffect_SetVertexUV(obj, 3, 48, 16);
}
if(type=="POWER_L")
{
ObjEffect_SetVertexUV(obj, 0, 48, 0);
ObjEffect_SetVertexUV(obj, 1, 64, 0);
ObjEffect_SetVertexUV(obj, 2, 48, 16);
ObjEffect_SetVertexUV(obj, 3, 64, 16);
}
if(type=="POWER_F")
{
ObjEffect_SetVertexUV(obj, 0, 96, 0);
ObjEffect_SetVertexUV(obj, 1, 112, 0);
ObjEffect_SetVertexUV(obj, 2, 96, 16);
ObjEffect_SetVertexUV(obj, 3, 112, 16);
}
while(Obj_BeDeleted(obj)==false)
{
if(GetCommonData("itemcollect")==1) //I set this to 1 whenever I want to auto collect all items like on event scripts, etc
{
collection=15;
}
if(ypos>GetClipMaxY+50) //deletes the item if it's way below the bottom of the screen
{
Obj_Delete(obj);
}
ypos+=yacc; //controls the falling
if(yacc<2)
{
yacc+=0.1;
}
ObjEffect_SetVertexXY(obj, 0, xpos-8, ypos-8); //sets XY rects
ObjEffect_SetVertexXY(obj, 1, xpos+8, ypos-8);
ObjEffect_SetVertexXY(obj, 2, xpos-8, ypos+8);
ObjEffect_SetVertexXY(obj, 3, xpos+8, ypos+8);
if(((xpos-GetPlayerX)^2+(ypos-GetPlayerY)^2)^0.5<=30) //if distance between item and player is less than 30, item moves to the player
{
collection=4;
}
if(((xpos-GetPlayerX)^2+(ypos-GetPlayerY)^2)^0.5<=10 && OnPlayerMissed==false) //if distance between item and player is less than 10 and player isn't dead, item is collected
{
if(type=="POWER_S") //if item is a small power item
{
SetCommonData("power", GetCommonData("power")+1);
AddScore(10);
}
if(type=="POWER_L") //if item is a large power item
{
SetCommonData("power", GetCommonData("power")+10);
AddScore(100);
}
if(type=="POWER_F") //if item is a full power item
{
SetCommonData("power", 100);
AddScore(1000);
}
if(type=="POINT") //if item is a point item... I still have to fix this :V
{
if(GetPlayerY>GetClipMinY+120)
{
AddScore(truncate(5*(GetCommonData("GRAZE")*100)/(GetPlayerY-GetClipMinY-120))+5000);
}else{
AddScore(5000+GetCommonData("GRAZE")*50);
}
AddPoint(1);
}
if(type=="COLLECT") //if item is a collection item
{
SetCommonData("collect", GetCommonData("collect")+1);
AddScore(50);
}
if(type=="COLLECT_L") //if item is a large collection item
{
SetCommonData("collect", GetCommonData("collect")+10);
AddScore(500);
}
Obj_Delete(obj);
}
if(GetCommonData("power")==100) //if power is full, I turned power items to my extra special item (item_drop is a function that sets common data so that the main stage script creates the items)
{
if(type=="POWER_S")
{
item_drop("COLLECT", xpos, ypos, 1, 0, 0);
Obj_Delete(obj);
}
if(type=="POWER_L")
{
item_drop("COLLECT_L", xpos, ypos, 1, 0, 0);
Obj_Delete(obj);
}
}
if(GetPlayerY<GetClipMinY+120 || OnBomb==true) //when the player is above the collection line or bombing, and isn't dead collect all the items...
{
if(OnPlayerMissed==false)
{
collection=10;
}
}
if(IsBossExisting==true) //Collect items disappear when there's a boss
{
if(type=="COLLECT"||type=="COLLECT_L")
{
Obj_Delete(obj);
}
}
if(collection>=1) //control movement when the item's being collected
{
xpos+=collection*cos(atan2(GetPlayerY-ypos, GetPlayerX-xpos));
ypos+=collection*sin(atan2(GetPlayerY-ypos, GetPlayerX-xpos));
}
yield;
}
}
Danmakufu Script Thread :V Latest Script: Intertwining Mechanical Intervention (temp name)

Yooooouuutuuuubeeee Channel Latest Video: Contest #8 Entry

KrackoCloud

  • I don't mean to be greedy...
  • ... but white rice is my favorite food.
Re: Danmakufu Q&A/Problem Thread v3
« Reply #912 on: June 05, 2010, 10:06:31 PM »
Is there a way to get bullets to "glow" together, rather than have their sprites overlap?

Iryan

  • Ph?nglui mglw?nafh
  • Cat R?lyeh wgah?nagl fhtagn.
Re: Danmakufu Q&A/Problem Thread v3
« Reply #913 on: June 05, 2010, 10:26:00 PM »
For that, you need to change the rendering type of these bullets to additive blend.

The thorough way to accomplish this is to create an entirely new shot data file where you define the rendering type as ADD instead of ALPHA. If you are using the expanded shot data or something similar already, you can simply make a copy of it, rename it, change the relevant instances of ALPHA to ADD and then refer to the alternate shot sheet when neccessary.

Another way to go about this would be to make the bullets lasers instead, as lasers are always rendered in additive blend, no matter what the original bullet data has.


As a precautious advice, instances where abuse of additive blended bullets make stuff difficult to read are a major source of rage for certain people, so use them wisely.  :derp:
Old Danmakufu stuff can be found here!

"As the size of an explosion increases, the numbers of social situations it is incapable of solving approaches zero."

Re: Danmakufu Q&A/Problem Thread v3
« Reply #914 on: June 06, 2010, 03:35:53 AM »
I'm trying to make an attack that speeds up, stops after a few seconds, then, after a while, shoots two bullets and moves away, but for some reason the Code I am using now Isn't working like that, whats wrong?
It shoots and all, then it stops, then it moves, but only half do, I have no idea why!

EDIT:
I noticed I left in the following commands, please delete them for script to work:
#include_function".\Main.txt"
Load;
DrawSat;

« Last Edit: June 06, 2010, 04:13:33 AM by Demonbman »

Iryan

  • Ph?nglui mglw?nafh
  • Cat R?lyeh wgah?nagl fhtagn.
Re: Danmakufu Q&A/Problem Thread v3
« Reply #915 on: June 06, 2010, 08:22:31 AM »
Found it!
Tthe problem lies here:
Quote
loop{
a+=5;
Fence(15,800-a,frame*3);
wait(4);
        }
Quote
if(frm==time*1.5){
...
}

frm increases by 1 every frame. If the parameter time in the Fence task is uneven, the condition if(frm==time*1.5) can neven become true. Since you change the parameter by 5 every time, half of the bullets will be unable to reach the requirement.

My tip to fix it? Change the line to:
Quote
if(frm == ceil( time*1.5 ) ){
Old Danmakufu stuff can be found here!

"As the size of an explosion increases, the numbers of social situations it is incapable of solving approaches zero."

GenericTouhouFailure

  • WHAT DO YOU MEAN IT'S NOT CALLED UNL? *boom*
Re: Danmakufu Q&A/Problem Thread v3
« Reply #916 on: June 06, 2010, 11:11:47 PM »
Code: [Select]
Long Code here
Thanks. I actually started on one too but never thought of checking if the player is dead :V
I really got to get my ass up and make a custom cutin soon. *searches for code to steal*
« Last Edit: June 07, 2010, 12:59:41 AM by GenericTouhouFan »

Chronojet ⚙ Dragon

  • The Oddity
  • 今コソ輝ケ、我ガ未来、ソノ可能性!!
Re: Danmakufu Q&A/Problem Thread v3
« Reply #917 on: June 07, 2010, 05:42:53 AM »
I really got to get my ass up and make a custom cutin soon. *searches for code to steal*

Wait a sec... This one's really easy to find.
This, it's Hele's TH10-12 cut-in script function. I've modified it for use in some of my newer scripts.
« Last Edit: June 07, 2010, 05:44:36 AM by みゅう⑨(Mewkyuu) »

espen

Re: Danmakufu Q&A/Problem Thread v3
« Reply #918 on: June 07, 2010, 05:01:08 PM »
I'm trying to make a bullet that gravitates around a specified center of gravity, following an inverse-square distance law. In other words, I want a=G/r2 in the direction of r.

A problem I ran into was I have to be able to independently change the x- and y-velocities of the bullet, but the only control I seem to have is if the speed and the angle of motion.

Wolfram Mathworld gives the expression for the acceleration vector. It might be possible to accomplish by designing a recursive function which decomposes the velocity vector of the bullet into the angular and radial components.

Has such a bullet already been designed? Does it look possible to accomplish?

Iryan

  • Ph?nglui mglw?nafh
  • Cat R?lyeh wgah?nagl fhtagn.
Re: Danmakufu Q&A/Problem Thread v3
« Reply #919 on: June 07, 2010, 05:17:09 PM »
It might be possible to accomplish by designing a recursive function which decomposes the velocity vector of the bullet into the angular and radial components.

Has such a bullet already been designed? Does it look possible to accomplish?

Code: [Select]
v= ( vx^2 + vy^2)^0.5;

angle = atan2(vy, vx);

This should do.
Old Danmakufu stuff can be found here!

"As the size of an explosion increases, the numbers of social situations it is incapable of solving approaches zero."

Azure Lazuline

  • Looooove!!
  • PM me for free huggles and love!
    • Entanma Project - indie game development
Re: Danmakufu Q&A/Problem Thread v3
« Reply #920 on: June 07, 2010, 05:30:18 PM »
Or you can move the bullet manually. Set speed and angle to 0, then just add the x and y speeds to its position every frame.

Bitz

  • So Moe!
  • *heart attack*
Re: Danmakufu Q&A/Problem Thread v3
« Reply #921 on: June 09, 2010, 04:31:40 AM »
Render targets. These things get nearly no mention except for three functions tucked away at the end of Drawing Functions (in the DNFWiki), which don't give any useful information apart from "this is a render target kthxbai." Apart from that, I've only heard about them once, mentioned in this thread when someone asked about a "rumbling" effect, and the reply was that someone else was trying using render targets to make it. They sound like something that requires a lot of brainpower to use and probably serve very little useful purpose at all anyways (unlike things like Object Shots, which can be very useful for shininess but are complicated to use), some sort of esoterica that would require delving into the Japanese documentation to find out about.

tl;dr

Yeah anyways, what's a render target, what can I do with them, how do I use them, etc.?

Azure Lazuline

  • Looooove!!
  • PM me for free huggles and love!
    • Entanma Project - indie game development
Re: Danmakufu Q&A/Problem Thread v3
« Reply #922 on: June 09, 2010, 04:52:11 AM »
They're somewhat hard to explain, but I'll try to give a short tutorial here, since I was just working with them recently.

Basically, they act as a canvas that you can draw other things on top of. Why is this useful? Say you have a complex background with 20 layers, but none of them move at all. I know, stupid, but work with me for now. You can simply draw all those onto a render target, then draw the target to the screen in DrawLoop rather than the 20 individual layers. This saves the processing power of drawing 19 images. Very useful with DrawText, since that function is pretty memory-heavy.
Another usage would be drawing a multi-layered background onto a render target, then loading it as a texture for an effect object, which you can then manipulate the vertices on, while each layer still animates individually!

All in all, it's not too useful, but it does have its situations. So how do you use it? It's easier to show example code, so here we go.


In @Initialize:
CreateRenderTarget("bg", 512, 512); // this creates the target, 512 by 512 pixels, and calls it "bg". Easy.
SetRenderTarget("bg"); // this sets it as the active drawing surface.
// (things like SetTexture, SetGraphicRect, etc. go here - the same as if you were drawing something normally.)
DrawGraphic(200,200) // draws the graphic at coordinates 200,200 of the render target, not the game field.
// (drawing more layers on it goes here. Draw as many things as you want.)
SetRenderTarget("DEFAULT"); // changes back to the default render target, which gets automatically drawn onto the playing field every frame. Make sure to do this when you're done drawing on a target.

In @DrawLoop:
SetTexture("bg"); // sets the texture to the render target we drew on before
SetGraphicRect(0,0,512,512); // normal drawing stuff here.
DrawGraphic(GetCenterX,GetCenterY); // draw it to the game field like normal - because we set the target back to "DEFAULT", DrawGraphic behaves like you're probably used to.


Other notes: If you're going to change what's drawn each frame, use ClearRenderTarget("bg"); each frame before you draw onto it to erase what was there from the previous frame. If you're loading it onto the texture of an effect object and it's changing each frame, remember that you need to use ObjEffect_SetTexture every frame so it loads the new texture (and you also need to re-declare the SetVertexUV's every time you change the texture).

That should be it. If you don't understand it, the best thing is just to experiment.

GenericTouhouFailure

  • WHAT DO YOU MEAN IT'S NOT CALLED UNL? *boom*
Re: Danmakufu Q&A/Problem Thread v3
« Reply #923 on: June 09, 2010, 08:55:25 AM »
>Load/Save CommonDataEx
>Error
>Wut? How :V

<<<Translation>>>
How to use SaveCommonDataEx and LoadCommonDataEx. No matter how I try, danmakufu bitches about the file and freezes.
inb4toldtoreadsometutorial

Helepolis

  • Charisma!
  • *
  • O-ojousama!?
Re: Danmakufu Q&A/Problem Thread v3
« Reply #924 on: June 09, 2010, 10:24:19 AM »
>Load/Save CommonDataEx
>Error
>Wut? How :V

<<<Translation>>>
How to use SaveCommonDataEx and LoadCommonDataEx. No matter how I try, danmakufu bitches about the file and freezes.

inb4toldtoreadsometutorial

Post code. You are not posting any code. People cannot help you efficiently if you don't post code. Post the code.

GenericTouhouFailure

  • WHAT DO YOU MEAN IT'S NOT CALLED UNL? *boom*
Re: Danmakufu Q&A/Problem Thread v3
« Reply #925 on: June 09, 2010, 11:05:06 AM »
For Example..
Code: [Select]
CreateCommonDataArea("Test");
LoadCommonDataEx("Test","new 2");
SetCommonDataEx("Test","lolwut",0);
SaveCommonDataEx("Test","new 2");
asdf
I don't even know how to use this lolwut.

Iryan

  • Ph?nglui mglw?nafh
  • Cat R?lyeh wgah?nagl fhtagn.
Re: Danmakufu Q&A/Problem Thread v3
« Reply #926 on: June 09, 2010, 11:13:42 AM »
For Example..
Code: [Select]
CreateCommonDataArea("Test");
LoadCommonDataEx("Test","new 2");
SetCommonDataEx("Test","lolwut",0);
SaveCommonDataEx("Test","new 2");
asdf
I don't even know how to use this lolwut.

I have no idea if this will work, but you may try changing "new 2" to "new2" or "new_2". Considering that this is about file names, I can totally see danmakufu screwing it up when spaces are involved.
Old Danmakufu stuff can be found here!

"As the size of an explosion increases, the numbers of social situations it is incapable of solving approaches zero."

Kylesky

  • *The Unknown*
  • Local Unbalanced Danmakufu Idiot Scripter
    • My useless youtube account... (will be useful in the future *I promise*)
Re: Danmakufu Q&A/Problem Thread v3
« Reply #927 on: June 09, 2010, 12:22:27 PM »
Code: [Select]
CreateCommonDataArea("Test");
LoadCommonDataEx("Test","new 2");
SetCommonDataEx("Test","lolwut",0);
SaveCommonDataEx("Test","new 2");
SaveCommonDataEx and LoadCommonDataEx saves and loads it from a .dat FILE

Here is what your code should actually look like:
Code: [Select]
CreateCommonDataArea("Test");
LoadCommonDataEx("Test",GetCurrentScriptDirectory~"new_2");
SetCommonDataEx("Test","lolwut",0);
SaveCommonDataEx("Test",GetCurrentScriptDirectory~"new_2");

also, make sure that before you use LoadCommonDataEx, that the .dat file already exists, else, an error will occur... this means, the first time you run the script, add a SaveCommonDataEx before calling it, or make sure that a SaveCommonDataEx is already called in the script before LoadCommonDataEx...
Danmakufu Script Thread :V Latest Script: Intertwining Mechanical Intervention (temp name)

Yooooouuutuuuubeeee Channel Latest Video: Contest #8 Entry

Zerro

  • ERRORS,
  • ERRORS EVERYWHERE
Need help with events
« Reply #928 on: June 09, 2010, 04:46:02 PM »
Where do I put the event?

When I put it inside a card and call it it works fine but the boss attacks while the event is going on.
Life's a shmup, play on lunatic.

Chronojet ⚙ Dragon

  • The Oddity
  • 今コソ輝ケ、我ガ未来、ソノ可能性!!
Re: Need help with events
« Reply #929 on: June 09, 2010, 04:52:25 PM »
Where do I put the event?

When I put it inside a card and call it it works fine but the boss attacks while the event is going on.
This sort of question goes into the Danmakufu Q/A Thread.

anyways,
if(!OnEvent) { MakeSomeFuckingDanmaku; }
OR
while(!OnEvent) { yield; } // if in a task

Use it like this:
Code: [Select]
let count = 10;
@MainLoop {
  if(!OnEvent) { count--; }
  if(count == 0) {
    CreateShot01(GetX, GetY, 3, GetAngleToPlayer, WHITE02, 0);
    count = 10;
  }
}
or like this:
Code: (Event!) [Select]
task Shot {
  while(!OnEvent) { yield; }
  loop {
    ascent(i in 0..10) { CreateShot01(GetX, GetY, 5, GetAngleToPlayer+i*360/10, RED01, 0); }
    loop (7) { yield; }
  }
}

If you choose the second option, you have to use a yield; somewhere in @MainLoop.
« Last Edit: June 09, 2010, 10:29:13 PM by μ⑨(Mewkyuu) »