Author Topic: Danmakufu Q&A/Problem Thread II  (Read 181088 times)

Iryan

  • Ph?nglui mglw?nafh
  • Cat R?lyeh wgah?nagl fhtagn.
Re: Danmakufu Q&A/Problem Thread II
« Reply #900 on: January 18, 2010, 05:41:34 PM »
Ohyouguys.
I don't care if Drake already solved the problem through another way. I just enjoy solving math problems too much.
Code: [Select]
let anorm;
let n1;
let n2;
let dist;

function GetDist(ox, oy, p1x, p1y, p2x, p2y){

anorm=atan2(p1y-p2y, p1x-p2x)-90;
n1=cos(anorm);
n2=sin(anorm);

// ->n = [cos(anorm), sin(anorm)] = [n1, n2]
// g:  [ox-p1x, oy-p1y]*[n1, n2]=0;

dist= ( (ox-p1x)*cos(anorm)+(oy-p1y)*sin(anorm) )/(( (n1)^2 + (n2)^2 )^0.5) ;

return dist;
}
Hooray for vectors!
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."

AweStriker Nova

  • Star Sign "Thunder Constellation"
Re: Danmakufu Q&A/Problem Thread II
« Reply #901 on: January 18, 2010, 06:04:19 PM »
Obj_Lasers cannot move with SetSpeed. You have to manually move them with SetPosition every frame:

Obj_SetPosition(obj, Obj_GetX(obj)+cos(Obj_GetAngle(obj))*Obj_GetSpeed(obj), Obj_GetY(obj)+sin(Obj_GetAngle(obj))*Obj_GetSpeed(obj))
Seems like a pain, but it's nice to know.

Helepolis

  • Charisma!
  • *
  • O-ojousama!?
Re: Danmakufu Q&A/Problem Thread II
« Reply #902 on: January 18, 2010, 06:46:01 PM »
Since you math gods are on a roll and steaming I better quickly ask my question:

How can I make an effect object interact with an object bullet? Let's keep it simple first. I got this square/rectangular shape. If the effect object comes near the bullets it will attract them ( like a magnet ).

Now I used this effect before for my items in my stage by using pythogoras formula. But this creates an circular radius to attract blocks. I prefer a rectangular/square to be honest.

Also coding with the player is easy because GetPlayerX/Y are usable. But when using two objects, how do I "emit" their X/Y positions? Do I use commondata which is updated each frame from both objects?


Iryan

  • Ph?nglui mglw?nafh
  • Cat R?lyeh wgah?nagl fhtagn.
Re: Danmakufu Q&A/Problem Thread II
« Reply #903 on: January 18, 2010, 08:00:27 PM »
If you have a fixed number of these magnet objects, you just create them inside the main script so you have definite names with which you can refer to them in the Obj_GetStuff functions.

If you spawn more and more of these magnet objects as time goes by, you need an object array inside the main script. Then you can refer to each of the objects using magnet[n], for example. You can make a task or function that creates the object and then inserts the object id into the array.

I once made a code like that. There was another problem I encountered which I couldn't fix, but I think that shouldn't arise here.

Code: [Select]

let obj_x=[Obj_Create(OBJ_EFFECT)];
Obj_Delete(obj_x[0]);
let magnet=[];

task bomber(x, y){

let obj=Obj_Create(OBJ_EFFECT);
obj_x=[obj];

magnet=magnet ~ obj_x;


Obj_SetPosition(obj_x[0], x, y);
//insert the drawing stuff you want here

while(Obj_BeDeleted(obj){ etc }

}
}

If you want mathematical equations on how to program the attraction effects, I'd like you to go a little more into detail about how exactly you want it to work.
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."

Helepolis

  • Charisma!
  • *
  • O-ojousama!?
Re: Danmakufu Q&A/Problem Thread II
« Reply #904 on: January 18, 2010, 08:03:00 PM »
no no, there is only 1 magnet object. So there is only 1 effect object that will live on the entire spellcard. ( only deactivating / activing itself but that is not a problem now ).

I refuse to use the MainLoop though. I know it is easier for interacting objects with eachother, but I want to pull this off with functions and tasks.

Iryan

  • Ph?nglui mglw?nafh
  • Cat R?lyeh wgah?nagl fhtagn.
Re: Danmakufu Q&A/Problem Thread II
« Reply #905 on: January 18, 2010, 08:06:05 PM »
Phew, having only one magnet to worry about makes this so much easier.

So, if you refuse to use the main loop, you can still create the object with a definite name (let's call it magnet) directly at the beginning of the script, then make a task that looks exactly like your avarage effect object task with all instances of obj replaced with magnet.

So... how do you want the magnet to work again..?
« Last Edit: January 18, 2010, 08:14:51 PM by Iryan »
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."

Helepolis

  • Charisma!
  • *
  • O-ojousama!?
Re: Danmakufu Q&A/Problem Thread II
« Reply #906 on: January 18, 2010, 08:12:28 PM »
Let me show it with a drawing. ( This shouldn't be hard, I am more like wondering how to use a rectangular collision detection instead circular =| )


Iryan

  • Ph?nglui mglw?nafh
  • Cat R?lyeh wgah?nagl fhtagn.
Re: Danmakufu Q&A/Problem Thread II
« Reply #907 on: January 18, 2010, 08:19:09 PM »
If you want every object to do something once it enters a square- or rectangle-formed space arounde the object, than that is not a problem at all as long as the square stays aligned to the regular x and y axes. If it spins, it gets more difficult, but then we could pretty much reuse the code(s) for Naut's problem.

If you want the bullets to be attracted towards the object no matter where they are, I am not shure what the difference between a circular and a rectangular attraction would be, aside maybe from the fact that the horizontal pull may be stronger or weaker than the vertical pull, but that would still be a piece of cake.

So...
Do you want the bullets to form a rectangular shape while being attracted? Because for that to happen you would have to spawn all bullets at the same time or the shape will be royally messed up anyways...
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."

Helepolis

  • Charisma!
  • *
  • O-ojousama!?
Re: Danmakufu Q&A/Problem Thread II
« Reply #908 on: January 18, 2010, 08:21:16 PM »
If you want every object to do something once it enters a square- or rectangle-formed space arounde the object, than that is not a problem at all as long as the square stays aligned to the regular x and y axes. If it spins, it gets more difficult, but then we could pretty much reuse the code(s) for Naut's problem.

If you want the bullets to be attracted towards the object no matter where they are, I am not shure what the difference between a circular and a rectangular attraction would be, aside maybe from the fact that the horizontal pull may be stronger or weaker than the vertical pull, but that would still be a piece of cake.

So...
Do you want the bullets to form a rectangular shape while being attracted? Because for that to happen you would have to spawn all bullets at the same time or the shape will be royally messed up anyways...

It doesn't matter the bullets have to form a square shape. They can be attracted to the center or w/e. I just want them to be attracted.

The Magnet will not spin, only move around vertical or horizontal.

I want a rectangular / square collision because I perhaps want the magnet to attract from the top as well ( strong pull ) so basically if the bullet enters  this part of the rectangular, it get's pulled.

Iryan

  • Ph?nglui mglw?nafh
  • Cat R?lyeh wgah?nagl fhtagn.
Re: Danmakufu Q&A/Problem Thread II
« Reply #909 on: January 18, 2010, 08:27:14 PM »
OK...

all bullets drift towards the magnet until they are positioned on the border of a rectangle which is probably the magnet's sprite.
__
|_|

Once they've reached this position, are they attached to and move with the magnet, do they simply vanish, or does something else happen entirely?

Also, can i assume that the magnet is wider than it is high?

*starts working on code*
« Last Edit: January 18, 2010, 08:37:18 PM by Iryan »
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."

Helepolis

  • Charisma!
  • *
  • O-ojousama!?
Re: Danmakufu Q&A/Problem Thread II
« Reply #910 on: January 18, 2010, 08:37:09 PM »
They don't have to dock with the with the magnet's border. Like I said, they can be pulled to the center. The rectangular / square shape is purely intended for the collision detection. Else I could just use the regular attraction code.

And correct, once they are "Caught" by the magnet, they will be moving alone with the magnet. As long as it stays active ( again this can be easy done with tasking ). I want to get in the pulling first + sticking. Secondary behaviour later.

Iryan

  • Ph?nglui mglw?nafh
  • Cat R?lyeh wgah?nagl fhtagn.
Re: Danmakufu Q&A/Problem Thread II
« Reply #911 on: January 18, 2010, 08:55:07 PM »
Ah, so the attraction is circular and just the collision detection is that of a rectangle?

Can't you simply give each object a variable that checks wether or not it is attached and one variable each for the relative x and y position towards the magnet after the attachment, then use something like...

let's assume the magnet is 100 pixels long and 60 pixels high, okay?

Code: [Select]
let att=false;
let attx=0;
let atty=0;

if(att==false){
if(Obj_GetX(obj)<(Obj_GetX(magnet)-50)||Obj_GetX(obj)>(Obj_GetX(magnet)+50)){
Obj_SetX(obj, Obj_GetX(obj) + v*cos(atan2(Obj_GetY(magnet)-Obj_GetY(obj), Obj_GetX(magnet)-Obj_GetX(obj))) );
} else{ attx=Obj_GetX(obj)-Obj_GetX(magnet); }
if(Obj_GetY(obj)<(Obj_GetY(magnet)-25)||Obj_GetY(obj)>(Obj_GetY(magnet)+25)){
Obj_SetY(obj, Obj_GetY(obj) + v*sin(atan2(Obj_GetY(magnet)-Obj_GetY(obj), Obj_GetX(magnet)-Obj_GetX(obj))) );
} else{ atty=Obj_GetY(obj)-Obj_GetY(magnet); }
}

if(attx!=0&&atty!=0){
Obj_SetSpeed(obj, 0);
att=true;
if(attx<50&&attx>0){attx=50; }
if(attx>-50&&attx<0){attx=-50; }
if(atty<30&&atty>0){atty=30; }
if(atty>-30&&atty<0){atty=-30; }

}

if(att==true){
Obj_SetPosition(obj, Obj_GetX(magnet)+attx, Obj_GetY(magnet)+atty);
}

The only thing halfway mathematically complicated in here is the circular attraction itself, really. Now to test this out, wait a moment...

Edit: Okay, the code works. The circular attraction is not partiuclarly pretty, I have to admit, but the bullets attach to the magnet exactly the way they should.


So... where do we go from here?
...wait, there's still an error...
« Last Edit: January 18, 2010, 09:21:17 PM by Iryan »
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."

Helepolis

  • Charisma!
  • *
  • O-ojousama!?
Re: Danmakufu Q&A/Problem Thread II
« Reply #912 on: January 18, 2010, 09:21:06 PM »
But where do I declare the Magnet effect object? I assume you all wrote this using the mainloop?   =S

Iryan

  • Ph?nglui mglw?nafh
  • Cat R?lyeh wgah?nagl fhtagn.
Re: Danmakufu Q&A/Problem Thread II
« Reply #913 on: January 18, 2010, 09:22:55 PM »
Code: [Select]

script_enemy_main{


let magnet=Obj_Create(OBJ_SHOT);
Obj_SetPosition(magnet, GetCenterX, GetCenterY-64);
Obj_SetAngle(magnet, 80);


task bullet(x, y, v1, v, ang){

let att=false;
let attx=0;
let atty=0;

let obj=Obj_Create(OBJ_SHOT);

Obj_SetPosition(obj, x, y);
Obj_SetAngle(obj, ang);
Obj_SetSpeed(obj, v1);
ObjShot_SetGraphic(obj, RED01);
ObjShot_SetDelay  (obj, 0);

let tangle=0;


while(Obj_BeDeleted(obj)==false){


if(att==false){
if(Obj_GetX(obj)<(Obj_GetX(magnet)-50)||Obj_GetX(obj)>(Obj_GetX(magnet)+50)){
Obj_SetX(obj, Obj_GetX(obj) + v*cos(atan2(Obj_GetY(magnet)-Obj_GetY(obj), Obj_GetX(magnet)-Obj_GetX(obj))) );
} else{ attx=Obj_GetX(obj)-Obj_GetX(magnet); }
if(Obj_GetY(obj)<(Obj_GetY(magnet)-25)||Obj_GetY(obj)>(Obj_GetY(magnet)+25)){
Obj_SetY(obj, Obj_GetY(obj) + v*sin(atan2(Obj_GetY(magnet)-Obj_GetY(obj), Obj_GetX(magnet)-Obj_GetX(obj))) );
} else{ atty=Obj_GetY(obj)-Obj_GetY(magnet); }
}

if(attx!=0&&atty!=0){
  Obj_SetSpeed(obj, 0);
  att=true;
   if(attx<50&&attx>0){attx=50; }
   if(attx>-50&&attx<0){attx=-50; }
   if(atty<30&&atty>0){atty=30; }
   if(atty>-30&&atty<0){atty=-30; }
}

if(att==true){
Obj_SetPosition(obj, Obj_GetX(magnet)+attx, Obj_GetY(magnet)+atty);
}

yield;
}


}


@MainLoop { }

//etc.

There is still an error which I have to fix, though. Please wait warmly until the edit is ready.
« Last Edit: January 18, 2010, 09:24:35 PM by Iryan »
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."

Helepolis

  • Charisma!
  • *
  • O-ojousama!?
Re: Danmakufu Q&A/Problem Thread II
« Reply #914 on: January 18, 2010, 09:38:51 PM »
Oh wow, one never stops learning. I didn't knew you could write the   let magnet = blabla (Obj_Shot)/Effect at the top as global so it can be used to call  Obj_GetX(magnet) inside other tasks.

lololololowwwwwwwwwwwwwww I feel suddenly so stupid XD

( waits warmly for your edit before going to bed )

Iryan

  • Ph?nglui mglw?nafh
  • Cat R?lyeh wgah?nagl fhtagn.
Re: Danmakufu Q&A/Problem Thread II
« Reply #915 on: January 18, 2010, 09:55:32 PM »
Moep. Moeeeeeeeeeeeeeeeeeeeep.

I'm too tired and cannot think straight anymore right now. Got up today at 5 in the morning and have to do it again tomorrow, so, no edit for you tonight, sorry.

You can still simply cut the
Code: [Select]
   if(attx<50&&attx>0){attx=50; }
   if(attx>-50&&attx<0){attx=-50; }
   if(atty<30&&atty>0){atty=30; }
   if(atty>-30&&atty<0){atty=-30; }
part from the code I posted, and it should work. It just won't work perfectly. I don't like it if somethng doesn't work perfectly.   :-X

Bah, you'll see for yourself. Maybe someone more competent will have solved this issue by the time I return from work tomorrow. Being in the same time zone shure does help with the correspondence, though.

Good night.
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."

Helepolis

  • Charisma!
  • *
  • O-ojousama!?
Re: Danmakufu Q&A/Problem Thread II
« Reply #916 on: January 18, 2010, 10:00:05 PM »
I appreciate your time. I'll look into it tommorow. If all fails, we'll just drop back commondata or something and such.

I am also off to bed.

Fujiwara no Mokou

  • Hourai Incarnate
  • Oh, so this trial of guts is for ME?
    • Profile
Re: Danmakufu Q&A/Problem Thread II
« Reply #917 on: January 19, 2010, 04:48:23 AM »
Alright, finishing up my stage...
Is there a way to load boss enemies, child enemies, and all of their sound effects/images/other files before spawning them within a stage script?

I noticed there's a slight pause just before a boss or child enemy spawns. After they spawn once, though, that pause is gone and you can re-load them hundreds of times without that split-second delay between each one. I want to know if there's a way to load them all without actually spawning them, similar to how ZUN does it in before each Touhou stage. Is there a way to do it in Danmakufu?

Re: Danmakufu Q&A/Problem Thread II
« Reply #918 on: January 19, 2010, 04:59:04 AM »
??

Loading graphics and sound/music is the only thing you can do.

Well fuck my shit then :(
« Last Edit: January 19, 2010, 05:42:22 AM by Naut »

Re: Danmakufu Q&A/Problem Thread II
« Reply #919 on: January 19, 2010, 05:01:29 AM »
Alright, finishing up my stage...
Is there a way to load boss enemies, child enemies, and all of their sound effects/images/other files before spawning them within a stage script?

I noticed there's a slight pause just before a boss or child enemy spawns. After they spawn once, though, that pause is gone and you can re-load them hundreds of times without that split-second delay between each one. I want to know if there's a way to load them all without actually spawning them, similar to how ZUN does it in before each Touhou stage. Is there a way to do it in Danmakufu?
Spawn them all at the beginning of the script maybe? (and then immediately kill them or something)

Azure Lazuline

  • Looooove!!
  • PM me for free huggles and love!
    • Entanma Project - indie game development
Re: Danmakufu Q&A/Problem Thread II
« Reply #920 on: January 19, 2010, 05:15:20 AM »
CompileEnemyFromFile? I never used it, but it should work. Failing that, just call all the enemies off-screen at the beginning and SetLifeZeroToAllEnemy next frame.

Blargel

  • RAWR!
  • I'M AN ANGRY LOLI!
Re: Danmakufu Q&A/Problem Thread II
« Reply #921 on: January 19, 2010, 07:01:00 AM »
CompileEnemyFromFile(enemyFilePath);

Do it for every enemy you plan to use for that stage. When the stage is over, and nothing is on the screen, don't forget to clear the cache storing the enemy's information so that it doesn't eat up massive amounts of memory in the long run.

ClearByteCodeCash

(Yes, cash, not cache)

As a side note, I don't believe bosses can be compiled beforehand. Also I swear to god clearing the byte code cache crashes my game every so often for no apparent reason. It could be something else, but since it happens right at the end of the stage, it's gotta either be the common data or the clearing of the byte code cache. And I really doubt common data will cause Danmakufu to crash considering how much I used it before. Perhaps ClearByteCodeCash is only supposed to be called in @Finalize and not at the end of a task...
<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.

Helepolis

  • Charisma!
  • *
  • O-ojousama!?
Re: Danmakufu Q&A/Problem Thread II
« Reply #922 on: January 19, 2010, 12:57:56 PM »
Iryan, I approached it on a different way. You are using SetPosition, but I am using SetAngle.

Obj_SetAngle(obj, atan2(Obj_GetY(magnet)-Obj_GetY(obj),Obj_GetX(magnet)-Obj_GetX(obj)));  inside the boxed collision statement and the bullets will change their angle to the magnet.

You can even set two collision boxes, like 1 which attracts the bullet and an inner box that sets the speed to 0, aka stuck to the magnet.


Iryan

  • Ph?nglui mglw?nafh
  • Cat R?lyeh wgah?nagl fhtagn.
Re: Danmakufu Q&A/Problem Thread II
« Reply #923 on: January 19, 2010, 01:56:57 PM »
Aha...

Well, I was using Obj_SetPosition so that you could have the magnet merely intefere with the regular movement of the bullet because I thought that was what you wanted to do. Ideally I then would have made the force of attraction increase as then bullet gets closer to the magnet, mimicking how attraction works in real-life physics.

However, yesterday I was merely working on the "properly-getting-stuck-to-the-magnet", and now I am going to make it work properly! FOR SCIENCE!

*goes of to the script folder*

Mmh, seems I was really tired yesterday. I seem to have confused the x and y axes with each other several times...  :V
« Last Edit: January 19, 2010, 02:03:43 PM by Iryan »
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."

Fujiwara no Mokou

  • Hourai Incarnate
  • Oh, so this trial of guts is for ME?
    • Profile
Re: Danmakufu Q&A/Problem Thread II
« Reply #924 on: January 19, 2010, 02:01:55 PM »

As a side note, I don't believe bosses can be compiled beforehand.

That's fine, all my boss enemies are child enemies, because CreateEnemyBoss was causing too many problems. Too many unwanted default stuff, like clearing the screen of all enemies at boss death.   

Iryan

  • Ph?nglui mglw?nafh
  • Cat R?lyeh wgah?nagl fhtagn.
Re: Danmakufu Q&A/Problem Thread II
« Reply #925 on: January 19, 2010, 02:20:03 PM »
Uuuh, Helepolis?

*cough* *cough*

Code: [Select]
let magnet=Obj_Create(OBJ_SHOT);
Obj_SetPosition(magnet, GetCenterX, GetCenterY-64);
Obj_SetAngle(magnet, 80);

let mdx=50; //half the width of the magnet, change value as you please
let mdy=30; //half the width of the magnet, change value as you please

task bullet(x, y, v1, v, ang){

let att=false;
let attx=0;
let atty=0;

let obj=Obj_Create(OBJ_SHOT);

Obj_SetPosition(obj, x, y);
Obj_SetAngle(obj, ang);
Obj_SetSpeed(obj, v1);
ObjShot_SetGraphic(obj, RED01);
ObjShot_SetDelay  (obj, 0);

let tangle=0;


while(Obj_BeDeleted(obj)==false){

tangle=atan2(Obj_GetY(magnet)-Obj_GetY(obj), Obj_GetX(magnet)-Obj_GetX(obj));

if(att==false){
if(Obj_GetX(obj)<(Obj_GetX(magnet)-50)||Obj_GetX(obj)>(Obj_GetX(magnet)+50)){
Obj_SetX(obj, Obj_GetX(obj) + v*cos(tangle) );
} else{ attx=Obj_GetX(obj)-Obj_GetX(magnet); }
if(Obj_GetY(obj)<(Obj_GetY(magnet)-25)||Obj_GetY(obj)>(Obj_GetY(magnet)+25)){
Obj_SetY(obj, Obj_GetY(obj) + v*sin(tangle) );
} else{ atty=Obj_GetY(obj)-Obj_GetY(magnet); }
}

if(attx!=0&&atty!=0){
  Obj_SetSpeed(obj, 0);
  att=true;


if(tangle<atan2(-mdy, -mdx)&&tangle>atan2(-mdy, mdx)){ atty=-mdy;}
if(tangle<atan2(-mdy, mdx)&&tangle>atan2(mdy, mdx)){ attx=mdx;}
if(tangle<atan2(mdy, mdx)&&tangle>atan2(mdy, -mdx)){ atty=mdy;}
if(tangle<atan2(mdy, -mdx)&&tangle>180){ attx=-mdx;}
if(tangle<(-180)&&tangle>atan2(-mdy, -mdx)){ attx=-mdx;}
}

if(att==true){
Obj_SetPosition(obj, Obj_GetX(magnet)+attx, Obj_GetY(magnet)+atty);
}

yield;
}


}

BITCHES!

 8)

Yeah, it really wasn't that difficult, afterall. I was just too tired to tell the x-axis from the y-axis.  :V

On a side note, I'd like to recommend "Skyforger" by Amorphis. Perfect for listening to while coding something. Just look at the lyrics.
« Last Edit: January 19, 2010, 02:21:46 PM by Iryan »
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."

Helepolis

  • Charisma!
  • *
  • O-ojousama!?
Re: Danmakufu Q&A/Problem Thread II
« Reply #926 on: January 19, 2010, 02:26:47 PM »
I see Iryan. Seems like you were overflowing the science part while I wanted an easy attraction. I'll see the code tonight. Thanks for the help.

Fujiwara no Mokou

  • Hourai Incarnate
  • Oh, so this trial of guts is for ME?
    • Profile
Re: Danmakufu Q&A/Problem Thread II
« Reply #927 on: January 19, 2010, 04:40:21 PM »
CompileEnemyFromFile(enemyFilePath);

Do it for every enemy you plan to use for that stage.
It's not working too well for me. Maybe I'm not doing it right? Can you give me an example with a stage script and enemy? Something that loads a large sound or image file, to have noticable pause when it spawns without the compileenemyfromfile function.

It doesn't have to do anything. I just want to see what I'm doing wrong.

Blargel

  • RAWR!
  • I'M AN ANGRY LOLI!
Re: Danmakufu Q&A/Problem Thread II
« Reply #928 on: January 19, 2010, 08:36:44 PM »
It's not working too well for me. Maybe I'm not doing it right? Can you give me an example with a stage script and enemy? Something that loads a large sound or image file, to have noticable pause when it spawns without the compileenemyfromfile function.

It doesn't have to do anything. I just want to see what I'm doing wrong.

I can already tell you what you're doing wrong from that text. You don't load sound or graphics in an enemy script if it's just a regular enemy since they probably won't be accessed in single or plural. CompileEnemyFromFile only compiles the behavior of the enemy, not load the graphics and sounds.  Load all your sounds and graphics that you'll use for the regular enemies at the beginning of the stage and delete them at the end of the stage. For the boss (even if it's how you're doing it with normal enemies), you can leave it how it is if you plan to allow the single or plural scripts that make it up be run separately.
<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.

Fujiwara no Mokou

  • Hourai Incarnate
  • Oh, so this trial of guts is for ME?
    • Profile
Re: Danmakufu Q&A/Problem Thread II
« Reply #929 on: January 19, 2010, 09:45:00 PM »
Load all your sounds and graphics that you'll use for the regular enemies at the beginning of the stage and delete them at the end of the stage.

How will I be doing that? If I put in let image=whatever.png; LoadGraphic(image);/etc in the stage script, will the child enemies correspond with that? Or am I missing some secret here?

My guess is to somehow make the sound and image files common data files in the stage script and then calling them in the child enemies. But I don't know how to properly approach this.
« Last Edit: January 20, 2010, 03:12:01 AM by Fujiwara no Mokou »