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

Magical Girl Satori~

  • obviously i am magical..
  • loljk im not i totally fooled you
Re: Danmakufu Q&A/Problem Thread II
« Reply #870 on: January 15, 2010, 10:28:48 PM »
oh, where?

AweStriker Nova

  • Star Sign "Thunder Constellation"
Re: Danmakufu Q&A/Problem Thread II
« Reply #871 on: January 15, 2010, 10:37:01 PM »
oh, where?

It should have "AppLocale" in the title

Magical Girl Satori~

  • obviously i am magical..
  • loljk im not i totally fooled you
Re: Danmakufu Q&A/Problem Thread II
« Reply #872 on: January 15, 2010, 10:54:31 PM »
Oh, yeah, that one. I tried it and it didnt work. I followed the tutorial correctly though. o-o

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 II
« Reply #873 on: January 16, 2010, 03:57:04 AM »
Is there some kind of function like set_color or shot_color for shot replace scripts? so it would be like... make a shot graphic that's grayscale then just use that to make different colored bullets? it would make things a LOT easier...
(someone should really add a list of shot replace script functions on the wiki :P)
« Last Edit: January 16, 2010, 03:58:37 AM by Kylesky »
Danmakufu Script Thread :V Latest Script: Intertwining Mechanical Intervention (temp name)

Yooooouuutuuuubeeee Channel Latest Video: Contest #8 Entry

AweStriker Nova

  • Star Sign "Thunder Constellation"
Re: Danmakufu Q&A/Problem Thread II
« Reply #874 on: January 16, 2010, 04:06:11 AM »
SetShotColor(red,green,blue)

There's a weakness though; if you're firing more than one bullet at the same time and they're supposed to be different colors, they'll all come out the one set with SetShotColor.

Chronojet ⚙ Dragon

  • The Oddity
  • 今コソ輝ケ、我ガ未来、ソノ可能性!!
Re: Danmakufu Q&A/Problem Thread II
« Reply #875 on: January 16, 2010, 04:07:38 AM »
There's a weakness though; if you're firing more than one bullet at the same time and they're supposed to be different colors, they'll all come out the one set with SetShotColor.
*cough* Here's an old snippet of code from some time back...
Code: (...Unless I'm doing something totally different from what you're trying to do...) [Select]
//...
task attack1 {
let a = 0; let b = 0;
loop {
loop(15) {
PlaySE("se\se_kira01.wav");
SetShotColor(255, 255, 255);
ascent(i in 0..6) { CreateShot01(GetX, GetY, 3, GetAngleToPlayer+a+i*360/6, PURPLE02, 0); }
SetShotColor(55, 55, 55);
ascent(i in 0..9) { CreateShot01(GetX, GetY, 2, GetAngleToPlayer+b+i*360/9, WHITE01, 0); }
a-=17; b-=9;
loop(2) { yield; }
}
SetMovePosition02(GetPlayerX, GetClipMinY+100+rand(-50, 50), 10);
}
}
//...

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 II
« Reply #876 on: January 16, 2010, 04:13:45 AM »
There's a weakness though; if you're firing more than one bullet at the same time and they're supposed to be different colors, they'll all come out the one set with SetShotColor.

well not really...
Code: [Select]
SetShotColor(100, 100, 255);
CreateShot01(GetX, GetY, 3, GetAngleToPlayer, 1, 30);
SetShotColor(100, 255, 255);
CreateShot01(GetX, GetY, 3, GetAngleToPlayer+10, 1, 30);
it works...
Danmakufu Script Thread :V Latest Script: Intertwining Mechanical Intervention (temp name)

Yooooouuutuuuubeeee Channel Latest Video: Contest #8 Entry

AweStriker Nova

  • Star Sign "Thunder Constellation"
Re: Danmakufu Q&A/Problem Thread II
« Reply #877 on: January 16, 2010, 04:14:08 AM »
*cough* Here's an old snippet of code from some time back...
Code: (...Unless I'm doing something totally different from what you're trying to do...) [Select]
//...
task attack1 {
let a = 0; let b = 0;
loop {
loop(15) {
PlaySE("se\se_kira01.wav");
SetShotColor(255, 255, 255);
ascent(i in 0..6) { CreateShot01(GetX, GetY, 3, GetAngleToPlayer+a+i*360/6, PURPLE02, 0); }
SetShotColor(55, 55, 55);
ascent(i in 0..9) { CreateShot01(GetX, GetY, 2, GetAngleToPlayer+b+i*360/9, WHITE01, 0); }
a-=17; b-=9;
loop(2) { yield; }
}
SetMovePosition02(GetPlayerX, GetClipMinY+100+rand(-50, 50), 10);
}
}
//...
well not really...
Code: [Select]
SetShotColor(100, 100, 255);
CreateShot01(GetX, GetY, 3, GetAngleToPlayer, 1, 30);
SetShotColor(100, 255, 255);
CreateShot01(GetX, GetY, 3, GetAngleToPlayer+10, 1, 30);
it works...
Oh. Right. More than once per frame. Gotcha.

Re: Danmakufu Q&A/Problem Thread II
« Reply #878 on: January 16, 2010, 07:05:00 AM »
Ok, how would I create like a "meter" on a player to show when a certain "thing" is ready to use? I've tried making two object effects, one for the "Meter Box" and one for the "Meter", but the player locks up on me, how would I do this?

Blargel

  • RAWR!
  • I'M AN ANGRY LOLI!
Re: Danmakufu Q&A/Problem Thread II
« Reply #879 on: January 16, 2010, 07:19:02 AM »
Object effects are the only way I can think of. You're probably doing something wrong. What do you mean by "the player locks up"?
<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.

Re: Danmakufu Q&A/Problem Thread II
« Reply #880 on: January 16, 2010, 07:20:26 AM »
Try to select the player in the Script Menu and it crashes danmakufu

Blargel

  • RAWR!
  • I'M AN ANGRY LOLI!
Re: Danmakufu Q&A/Problem Thread II
« Reply #881 on: January 16, 2010, 08:01:43 AM »
Make sure you aren't trying to create the object effects in @Initialize. If you're calling the task that makes them in @Initialize, you can just put a yield at the very beginning of the task and it should work.
<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.

Re: Danmakufu Q&A/Problem Thread II
« Reply #882 on: January 16, 2010, 05:02:02 PM »
Make sure you aren't trying to create the object effects in @Initialize. If you're calling the task that makes them in @Initialize, you can just put a yield at the very beginning of the task and it should work.
BWAHAHAHAHA it still crashes...

Iryan

  • Ph?nglui mglw?nafh
  • Cat R?lyeh wgah?nagl fhtagn.
Re: Danmakufu Q&A/Problem Thread II
« Reply #883 on: January 16, 2010, 05:13:26 PM »
Post a script, then we may be able to tell you what's wrong.

Just saying "I have a script, and it doesn't work" will only give you the most general advices.


I remember that danmakufu will crash every time you select a script if the name of a folder in your player directory in has spaces between words. That probably isn't your problem as from your posts it sounds as if you had already tested your player before trying to implement your gauge, but I'll just say it 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."

Re: Danmakufu Q&A/Problem Thread II
« Reply #884 on: January 16, 2010, 05:20:46 PM »
Ok, here is the Script: WARNING! this is just me testing out how to use Obj_Shots in players, and I had this idea to make it so when the meter is full, You could slow time for a bit.
Code: [Select]
#東方弾幕風[Player]  #ScriptVersion[2]   #Menu[PPL 1]      #Text[PPL 1]      #Image[.imgossimg.png]   #ReplayName[PPL 1]
script_player_main{
let CSD = GetCurrentScriptDirectory();let PPL = CSD~"imgossimg.png";let PPLCut = CSD~"imgossimgCut.png";let frame = 0;let speed = 5;let MeterBox = CSD~"imgMeter Box.png";let Meter = CSD~"imgBar.png";let slow = false;
task   Lagger(x,y){yield;
   let obj=Obj_Create(OBJ_SHOT);   let speedd=0;   let frame1=0;
   Obj_SetPosition(obj,x,y);   ObjShot_SetGraphic(obj,3);   ObjShot_SetDamage(obj,0.1);   ObjShot_SetPenetration(obj,10);   Obj_SetAngle(obj,0);   Obj_SetSpeed(obj,speedd);   Obj_SetAlpha(obj,75);
   while(Obj_BeDeleted(obj)==false){frame1++;   if(frame1>120){speedd+=0.2; Obj_SetSpeed(obj,speedd);   Obj_SetAngle(obj,atan2(GetEnemyY-Obj_GetY(obj),GetEnemyX-Obj_GetX(obj)));}
      yield;}   Obj_Delete(obj);}

task   Da(angle){yield;let obj=Obj_Create(OBJ_SHOT); let speedd=-3; let frame1=0;
   Obj_SetPosition(obj,GetPlayerX,GetPlayerY);   ObjShot_SetGraphic(obj,2);   ObjShot_SetDamage(obj,0.5);   ObjShot_SetPenetration(obj,3);    Obj_SetAngle(obj,angle);   Obj_SetSpeed(obj,speedd);   Obj_SetAlpha(obj,75);
   while(Obj_BeDeleted(obj)==false){frame1++;   if(frame1>60){speedd+=0.2; Obj_SetSpeed(obj,speedd);}      yield;}}
task   SlowMeter{yield;let meter=Obj_Create(OBJ_EFFECT);
        ObjEffect_SetTexture(meter, MeterBox);        ObjEffect_SetPrimitiveType(meter, PRIMITIVE_TRIANGLEFAN);        ObjEffect_CreateVertex(meter, 4);
          ObjEffect_SetVertexXY(meter, 0, GetClipMaxX, GetClipMaxY-150);          ObjEffect_SetVertexUV(meter, 0, 0, 0);           ObjEffect_SetVertexXY(meter, 1, GetClipMaxX+200, GetClipMaxY-150);          ObjEffect_SetVertexUV(meter, 1, 150, 0);
          ObjEffect_SetVertexXY(meter, 2, GetClipMaxX+200, GetClipMaxY);          ObjEffect_SetVertexUV(meter, 2, 150,100);
          ObjEffect_SetVertexXY(meter, 3, GetClipMaxX, GetClipMaxY);          ObjEffect_SetVertexUV(meter, 3, 0, 100);          ObjEffect_SetLayer(meter,8);
   }
task   Bar{yield;let meter=Obj_Create(OBJ_EFFECT);let SlowMeter = 0;let deframe=false;let dframe=120;
        ObjEffect_SetTexture(meter, Meter);        ObjEffect_SetPrimitiveType(meter, PRIMITIVE_TRIANGLEFAN);        ObjEffect_CreateVertex(meter, 4);while(!Obj_BeDeleted(meter)){SlowMeter+=1;   if(SlowMeter==190){SlowMeter=190; slow=true;}   if(GetKeyState(VK_USER)==KEY_PUSH || GetKeyState(VK_USER)==KEY_HOLD){deframe=true;}   if(deframe==true){dframe--;}   if(dframe==0){dframe=0; deframe=false;}
          ObjEffect_SetVertexXY(meter, 0, GetClipMaxX+5, GetClipMaxY-65);          ObjEffect_SetVertexUV(meter, 0, 0, 0);           ObjEffect_SetVertexXY(meter, 1, GetClipMaxX+5+SlowMeter, GetClipMaxY-65);          ObjEffect_SetVertexUV(meter, 1, 150, 0);
          ObjEffect_SetVertexXY(meter, 2, GetClipMaxX+5+SlowMeter, GetClipMaxY-6);          ObjEffect_SetVertexUV(meter, 2, 150,100);
          ObjEffect_SetVertexXY(meter, 3, GetClipMaxX+5, GetClipMaxY-6);          ObjEffect_SetVertexUV(meter, 3, 0, 100);          ObjEffect_SetLayer(meter,8);}}
   @Initialize{   yield;
   SetPlayerLifeImage(PPL, 0, 0, 33, 63);   LoadGraphic(PPL);   LoadGraphic(PPLCut);   LoadGraphic(MeterBox);   LoadGraphic(Meter);   SetSpeed(speed, 2);   LoadPlayerShotData(CSD~"shotdata.txt");   SetItemCollectLine(128);
      }@MainLoop{   yield;    if(frame==20){}   if(GetKeyState(VK_SHOT)==KEY_PUSH || GetKeyState(VK_SHOT)==KEY_HOLD){frame++;   if(frame>300 && frame<400 && frame%2==0){Lagger(GetPlayerX,GetPlayerY);}   if(frame<100 && frame%3==0){ascent(i in 1..11){Da(270-5*i); Da(270+5*i);}}   if(GetKeyState(VK_USER)==KEY_PUSH && slow==true){Slow(1);}else{Slow(0);}   if(frame==500){frame=0;}CreatePlayerShot01(GetPlayerX, GetPlayerY, 18, 270, 0.5, 200, 1);}   SetIntersectionCircle(GetPlayerX, GetPlayerY, 1);   
   }@Missed{}@SpellCard{yield;
if(GetKeyState(VK_SLOWMOVE)==KEY_PUSH || GetKeyState(VK_SLOWMOVE)==KEY_HOLD){UseSpellCard("rawr", true);}else{UseSpellCard("rawr", true);}
CutIn(KOUMA, "Genjutsu -Sakura-", PPLCut);            }@DrawLoop{yield;SetTexture(PPL);SetRenderState(ALPHA);SetGraphicAngle(0,0,0);SetGraphicScale(1.35,1.35);if(GetKeyState(VK_LEFT)==KEY_PUSH || GetKeyState(VK_LEFT)==KEY_HOLD){SetGraphicRect(32,0,69,62);}else if(GetKeyState(VK_RIGHT)==KEY_PUSH || GetKeyState(VK_RIGHT)==KEY_HOLD){SetGraphicAngle(180,0,0); SetGraphicRect(32,0,69,62);}else{SetGraphicRect(0,0,33,63);}
      DrawGraphic(GetPlayerX, GetPlayerY);SlowMeter; Bar;   }@Finalize{DeleteGraphic(PPL);}
}
script_spell   rawr{let Tree = GetCurrentScriptDirectory~"img.png";let petals = GetCurrentScriptDirectory~"ingpetals.png";let obj=Obj_Create(OBJ_SPELL);let obj2=Obj_Create(OBJ_SPELL);let spin = 4;         @Initialize{yield; LoadGraphic(Tree); LoadGraphic(petals); run(); }   @MainLoop{spin++; yield; }   @Finalize{DeleteGraphic(Tree);}      task   run(){yield; SetPlayerInvincibility(150); loop(10){yield;} Fire; loop(140){yield;} End;}      task   Fire{ let posx = GetEnemyX;let posy = GetEnemyY;let fwa = 0;                ObjEffect_SetTexture(obj,Tree);      ObjEffect_SetScale(obj,1,1);      ObjEffect_SetRenderState(obj,255);      ObjEffect_CreateVertex(obj,4);      ObjEffect_SetLayer(obj,1);      ObjEffect_SetPrimitiveType(obj,PRIMITIVE_TRIANGLEFAN);
   while(Obj_BeDeleted(obj)==false){yield;   posx=GetCenterX;   posy=GetCenterY;
   ObjEffect_SetVertexXY(obj,0,posx-60*2-fwa,posy-60*2-fwa);   ObjEffect_SetVertexUV(obj,0,0,0);   ObjEffect_SetVertexXY(obj,1,posx+60*2+fwa,posy-60*2-fwa);   ObjEffect_SetVertexUV(obj,1,0,512);      ObjEffect_SetVertexXY(obj,2,posx+60*2+fwa,posy+60*2+fwa);   ObjEffect_SetVertexUV(obj,2,512,512);   ObjEffect_SetVertexXY(obj,3,posx-60*2-fwa,posy+60*2+fwa);   ObjEffect_SetVertexUV(obj,3,512,0);ObjSpell_SetIntersecrionCircle(obj,posx,posy,120,20,true);      yield;}}}

EDIT:Well crap, the code box worked, but it messed it all up  >:(
« Last Edit: January 16, 2010, 05:23:34 PM by Demonbman »

Iryan

  • Ph?nglui mglw?nafh
  • Cat R?lyeh wgah?nagl fhtagn.
Re: Danmakufu Q&A/Problem Thread II
« Reply #885 on: January 16, 2010, 05:36:32 PM »
I have quite some trouble reading through that code cluster, but could it be that you placed {} brackets in your object tasks in such a way that the script_player_main part is closed before it gets to @Initialize or something?


Wait...
Quote
#Image[.imgossimg.png]

...shouldn't that be 
Quote
#Image[.\imgossimg.png]
« Last Edit: January 16, 2010, 05:42:31 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."

Drake

  • *
Re: Danmakufu Q&A/Problem Thread II
« Reply #886 on: January 16, 2010, 05:42:27 PM »
The hell is with you and messy code; I can't read anything in there. Do you want us to solve your problem or not?

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

Re: Danmakufu Q&A/Problem Thread II
« Reply #887 on: January 16, 2010, 05:48:14 PM »
Look, Its not my fault the code is like that, The code box on glitches when I use it  >:(  and you didn't have to be so rude...

Here is the code LIKE IT IS: http://www.mediafire.com/?hwnndz2ztrg
WHAT THE FUCK IS UP WITH THE COLOR FONT THLASDHFLASDOAGEDIT: Fixed

« Last Edit: January 16, 2010, 05:49:54 PM by Demonbman »

Iryan

  • Ph?nglui mglw?nafh
  • Cat R?lyeh wgah?nagl fhtagn.
Re: Danmakufu Q&A/Problem Thread II
« Reply #888 on: January 16, 2010, 05:53:23 PM »
...you have a yield in @Initialize? That could screw things up, I suppose...
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 II
« Reply #889 on: January 16, 2010, 05:57:20 PM »
...you have a yield in @Initialize? That could screw things up, I suppose...
Still Freezes, here, let me put up the graphics and such for you guys,EDIT: Here it is: http://www.mediafire.com/?wannttdyytd
« Last Edit: January 16, 2010, 05:59:40 PM by Demonbman »

Iryan

  • Ph?nglui mglw?nafh
  • Cat R?lyeh wgah?nagl fhtagn.
Re: Danmakufu Q&A/Problem Thread II
« Reply #890 on: January 16, 2010, 06:23:15 PM »
Quote
task   SlowMeter{ ... }
Quote
let SlowMeter = 0;
Defining two different things under the same name is not a good idea, either, although that probably isn't what causes your crashing...

Will tinker a little more after dinner. Unless someone finds the error before I'm done, that is.
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 II
« Reply #891 on: January 16, 2010, 06:27:41 PM »
Defining two different things under the same name is not a good idea, either, although that probably isn't what causes your crashing...

Will tinker a little more after dinner. Unless someone finds the error before I'm done, that is.

oh.... *fixes* ok, it still crashes. but let me try to put it in different places

Iryan

  • Ph?nglui mglw?nafh
  • Cat R?lyeh wgah?nagl fhtagn.
Re: Danmakufu Q&A/Problem Thread II
« Reply #892 on: January 16, 2010, 06:54:10 PM »
Your Bar task has no yield; in its while{} brackets.

Also, your slow meter doesn't even have a while{} part, so you'd want to fix that afterwards, too.
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 #893 on: January 17, 2010, 11:57:32 PM »
Code: [Select]
#TouhouDanmakufu
#Title[-VOID-]
#Text[It can't be resisted!]
#Player[FREE]
#ScriptVersion[2]

script_enemy_main{

let CSD = GetCurrentScriptDirectory;
let imgBoss = CSD ~ "Materials\Graphics\PlaceholderBoss.png";
#include_function "lib\ExpandedShotDatav4\shot_replace.dnh";

@Initialize{
SetLife(1000);
SetDamageRate(25,15);
SetTimer(40);
SetScore(1000);
SetMovePosition01(GetCenterX,GetCenterY,5);
LoadGraphic(imgBoss);
CutIn(KOUMA,"VOID",0,0,0,0);
ShotInit;
mainTask;
}

@MainLoop{

yield;
}

@DrawLoop{

SetTexture(imgBoss);
SetRenderState(ALPHA);
SetAlpha(255);
SetGraphicRect(0,0,64,64);
SetGraphicScale(1,1);
SetGraphicAngle(0,0,0);
DrawGraphic(GetX,GetY);

}

@BackGround{



}

@Finalize{

DeleteGraphic(imgBoss);

}
task mainTask{
wait(5);
fire(GetX,GetY,GetAngleToPlayer,BLUE02);
SetMovePositionRandom01(150,50,7,0,0,GetCenterX*2,GetCenterY+50);
wait(30);
fire(GetX,GetY,270,BLUE02);
}

task fire(x,y,dir,graphic){
let expand = 0;
let lsr = Obj_Create(OBJ_LASER);
ObjShot_SetBombResist(lsr,true);
ObjShot_SetGraphic(lsr,graphic);
ObjLaser_SetWidth(lsr,5);
ObjLaser_SetLength(lsr,5);
ObjLaser_SetSource(lsr,false);
Obj_SetAngle(lsr,dir);
Obj_SetPosition(lsr,x,y);
Obj_SetSpeed(lsr,0);
while(Obj_BeDeleted(lsr)==false){
if(expand<120){
ObjLaser_SetWidth(lsr,5+expand);
ObjLaser_SetLength(lsr,5+expand);
expand+=2;
wait(1);
}else{
Obj_SetSpeed(lsr,5);
Obj_SetAngle(lsr,dir);
}
if(Obj_GetX(lsr)<0||Obj_GetX(lsr)>GetCenterX*2){
burst(Obj_GetX(lsr),Obj_GetY(lsr));
Obj_Delete(lsr);
}
if(Obj_GetY(lsr)>GetCenterY*2||Obj_GetY(lsr)<0){
burst(Obj_GetX(lsr),Obj_GetY(lsr));
Obj_Delete(lsr);
}
wait(1);
}
}

task burst(x,y){
let pentblast = rand_int(0,359);
ascent(a in 1..60){
ascent(v in 1..4){
CreateShot01(x,y,3*v,360/a,SP02,0);
}
}
}

function wait(w){
loop(w){yield;}
}

}
The laser will expand to the right size, but not move. And since the whole spellcard relies on them moving...

Blargel

  • RAWR!
  • I'M AN ANGRY LOLI!
Re: Danmakufu Q&A/Problem Thread II
« Reply #894 on: January 18, 2010, 04:07:28 AM »
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))
<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.

Re: Danmakufu Q&A/Problem Thread II
« Reply #895 on: January 18, 2010, 04:57:15 AM »
Hey. Haven't thought about this enough to really post about it (to my standards, means a little less than a week), but I got a lot of other things to accomplish too so whatever. I need to make sure that the red dot doesn't escape the bounded field indicated.



It needs to stay inside those coordinates, no matter what. I cannot use Obj_IsIntersected. The coordinates are moving every frame. I can get all five coordinates every frame. No, the red dot doesn't actually bounce (it will default to the edge of the rectangle if it goes beyond). How would I make sure that the red dot doesn't escape the rectangle? I have a manual check code in mind but I'd rather not do it that way, I'm hoping there is a more efficient way to get whether or not the red dot has left the area and thus needs to be moved back to the edge of it, some math I can do or whatever.

Any ideas? Thanks in advance.

Blargel

  • RAWR!
  • I'M AN ANGRY LOLI!
Re: Danmakufu Q&A/Problem Thread II
« Reply #896 on: January 18, 2010, 06:05:15 AM »
I don't see why you can't use Obj_IsIntersected with invisible object lasers that don't do collision with the player. If there's some reason that cannot be explained easily (or quickly) on why you can't use Obj_IsIntersected, the only other way would be manual checks with math. What effect are you trying to accomplish with this sort of set up? Maybe you're overthinking what's needed for that instead.
<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.

Drake

  • *
Re: Danmakufu Q&A/Problem Thread II
« Reply #897 on: January 18, 2010, 06:10:47 AM »
shut up blargel i'm doing math



Yep. You can get the distance between the character and the line made by the two corners. Tbh I was never actually taught this, I just used it to shortcut through some questions in grade 12 >_>

The three points make a triangle. First you find the area of the triangle (Yes it's a weird formula):
triarea = abs(0.5*((x1*y2 + x2*y3 + x3*y1) - (y1*x2 + y2*x3 + y3*x1)));

Then you get the base of the triangle with the wall coordinates:
tribase = ((x2-x1)^2 + (y2-y1)^2)^0.5;

Now you can find the height of the triangle, or the distance between the character and the wall:
triheight = 2*triarea/tribase;

If you wanna be really pro you can put it in a single formula lol:
function GetDistToWall(x1,y1,x2,y2,x3,y3){
    return 2 * abs(0.5*((x1*y2+x2*y3+x3*y1)-(y1*x2+y2*x3+y3*x1))) / (((x2-x1)^2 + (y1-y2)^2)^0.5);
}


So if( GetDistToWall(enter, points, here) < 5){  back the fuck up;  } and there you go.
« Last Edit: January 18, 2010, 06:39:51 AM by DRE∀K DOWN! »

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

Blargel

  • RAWR!
  • I'M AN ANGRY LOLI!
Re: Danmakufu Q&A/Problem Thread II
« Reply #898 on: January 18, 2010, 08:11:22 AM »
shut up blargel i'm doing math
D:

Quote
Yep. You can get the distance between the character and the line made by the two corners. Tbh I was never actually taught this, I just used it to shortcut through some questions in grade 12 >_>

The three points make a triangle. First you find the area of the triangle (Yes it's a weird formula):
triarea = abs(0.5*((x1*y2 + x2*y3 + x3*y1) - (y1*x2 + y2*x3 + y3*x1)));

Then you get the base of the triangle with the wall coordinates:
tribase = ((x2-x1)^2 + (y2-y1)^2)^0.5;

Now you can find the height of the triangle, or the distance between the character and the wall:
triheight = 2*triarea/tribase;

If you wanna be really pro you can put it in a single formula lol:
function GetDistToWall(x1,y1,x2,y2,x3,y3){
    return 2 * abs(0.5*((x1*y2+x2*y3+x3*y1)-(y1*x2+y2*x3+y3*x1))) / (((x2-x1)^2 + (y1-y2)^2)^0.5);
}


So if( GetDistToWall(enter, points, here) < 5){  back the fuck up;  } and there you go.

That's a nice solution. If I had to think about it, I'd probably have done about 50 extra unnecessary steps to get the damn distance to the wall.
I'm totally stealing that bit of code and adding it to my library for later use.
<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.

Re: Danmakufu Q&A/Problem Thread II
« Reply #899 on: January 18, 2010, 04:16:20 PM »
ilu i want your babies drake