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

Chronojet ⚙ Dragon

  • The Oddity
  • 今コソ輝ケ、我ガ未来、ソノ可能性!!
Re: Danmakufu Q&A/Problem Thread II
« Reply #360 on: November 13, 2009, 04:04:38 AM »
hi, yeah, another question...how do I get an enemy to move along a path that looks like a complete circle...?
can't quite get it...
SetMovePosition02(x+radius*cos(a), y+radius*sin(a), frames);
I think...

Re: Danmakufu Q&A/Problem Thread II
« Reply #361 on: November 13, 2009, 04:08:44 AM »
hi, yeah, another question...how do I get an enemy to move along a path that looks like a complete circle...?
can't quite get it...

use SetMovePositionHerminte, its in the Tutorials

Lawence Codye

  • The Nine Tails of Subconscious...
  • Come & your desires shall all become reality...
Re: Danmakufu Q&A/Problem Thread II
« Reply #362 on: November 13, 2009, 04:11:09 AM »
use SetMovePositionHerminte, its in the Tutorials

oh, my bad, not used to enemy scripts...I'll umm, check that out then...thanks...

anywho...next question...
How the hell, do I use "GetTimer" to make something happen at a certain point after
the spellcard has started like 30secs into the spellcard attack?
...I don't even understand the parameters of this function...
« Last Edit: November 13, 2009, 06:33:30 AM by UltimaRepman »
I am the Nine Tails of Subconscious...

Come & your greatest desires will be reality...

Chronojet ⚙ Dragon

  • The Oddity
  • 今コソ輝ケ、我ガ未来、ソノ可能性!!
Re: Danmakufu Q&A/Problem Thread II
« Reply #363 on: November 13, 2009, 06:59:25 AM »
oh, my bad, not used to enemy scripts...I'll umm, check that out then...thanks...

anywho...next question...
How the hell, do I use "GetTimer" to make something happen at a certain point after
the spellcard has started like 30secs into the spellcard attack?
...I don't even understand the parameters of this function...
if(GetTimer < a certain number) { variable++; } is what I use to make stuff happen after like, the timer reads 60 secs and under.

Lawence Codye

  • The Nine Tails of Subconscious...
  • Come & your desires shall all become reality...
Re: Danmakufu Q&A/Problem Thread II
« Reply #364 on: November 13, 2009, 07:18:22 AM »
thanks Always お⑨烏...

last question for now...hopefully...
what the hell is wrong with this script(& it's not a directory issue I know that already, thus no image files...)...?
Code: [Select]
#TouhouDanmakufu
#Title[Pattern003]
#Text[]
#Image[.\system\ArtMirror.png]
#BackGround[.\system\BGMirror.png]
#Player[FREE]
#ScriptVersion[2]

script_enemy_main{
  let CSD = GetCurrentScriptDirectory();
  let imgBoss = CSD ~ ".\system\Mirror.png";
  let m = 0;

  @Initialize{
    SetLife(4000);
    SetTimer(66);
    SetInvincibility(180);
    SetScore(666666);
    MagicCircle(false);
    Expert;
    SetMovePosition01(GetCenterX, GetCenterY-150, 1);
    LoadGraphic(imgBoss);
    mainTask;
  }

  @MainLoop{
    SetCollisionA(GetX, GetY, 32);
    SetCollisionB(GetX, GetY, 16);
    yield;
  }

  @DrawLoop{
    SetTexture(imgBoss);
    SetRenderState(ALPHA);
    SetAlpha(250);
    SetGraphicScale(1, 1);
    SetGraphicAngle(0, 0, 0);
    if(GetEnemyLife>2000){SetGraphicRect(0, 44, 47, 75);} //Purple
    if(GetEnemyLife<2000){SetGraphicRect(51, 44, 98, 75);} //Orchid?...
    if(GetEnemyLife<750){SetGraphicRect(102, 44, 149, 75);} //Gray
    }
    DrawGraphic(GetX, GetY);
    m++;
    if(m==30){m=0;}
  }

  @Background{
  }

  @Finalize{
    DeleteGraphic(imgBoss);
  }

  task mainTask{
    wait(90);
    yield;
    movement;
    fire;
  }

  task movement{
    loop{
      SetMovePosition02(GetCenterX+50, GetCenterY-100, 60);
      wait(61);
      SetMovePosition02(GetCenterX, GetCenterY-50, 60);
      wait(61);
      SetMovePosition02(GetCenterX-50, GetCenterY-100, 60);
      wait(61);
      SetMovePosition02(GetCenterX, GetCenterY-150, 60);
      wait(61);
      yield;
    }
  }

  task fire{
    let x = 0;
    let dirf = 0;
    loop{
      while(x<36){
        CreateShotA(5, GetEnemyX+25*cos(dirf), GetEnemyY+25*sin(dirf), 6);
        SetShotDataA(5, 0, 2, dirf, 0.4, 0, 3, WHITE05);
        FireShot(5);
        CreateShotA(5, GetEnemyX+25*cos(dirf), GetEnemyY+25*sin(dirf), 6);
        SetShotDataA(5, 90, 2, dirf, -0.2, 0, 3, WHITE05);
        FireShot(5);
        CreateShotA(5, GetEnemyX+25*cos(dirf), GetEnemyY+25*sin(dirf), 6);
        SetShotDataA(5, 180, 2, dirf, 0.4, 0, 3, WHITE05);
        FireShot(5);
        CreateShotA(5, GetEnemyX+25*cos(dirf), GetEnemyY+25*sin(dirf), 6);
        SetShotDataA(5, 270, 2, dirf, -0.2, 0, 3, WHITE05);
        FireShot(5);
        dirf+=360/36;
        x++;
      }
    x = 0;
    dirf = 0;
    wait(60);
    yield;
    }
  }

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

}
it keeps returning the error below;
I am the Nine Tails of Subconscious...

Come & your greatest desires will be reality...

Blargel

  • RAWR!
  • I'M AN ANGRY LOLI!
Re: Danmakufu Q&A/Problem Thread II
« Reply #365 on: November 13, 2009, 07:24:06 AM »
thanks Always お⑨烏...

last question for now...hopefully...
what the hell is wrong with this script(& it's not a directory issue I know that already, thus no image files...)...?
Code: [Select]
#TouhouDanmakufu
#Title[Pattern003]
#Text[]
#Image[.\system\ArtMirror.png]
#BackGround[.\system\BGMirror.png]
#Player[FREE]
#ScriptVersion[2]

script_enemy_main{
  let CSD = GetCurrentScriptDirectory();
  let imgBoss = CSD ~ ".\system\Mirror.png";
  let m = 0;

  @Initialize{
    SetLife(4000);
    SetTimer(66);
    SetInvincibility(180);
    SetScore(666666);
    MagicCircle(false);
    Expert;
    SetMovePosition01(GetCenterX, GetCenterY-150, 1);
    LoadGraphic(imgBoss);
    mainTask;
  }

  @MainLoop{
    SetCollisionA(GetX, GetY, 32);
    SetCollisionB(GetX, GetY, 16);
    yield;
  }

  @DrawLoop{
    SetTexture(imgBoss);
    SetRenderState(ALPHA);
    SetAlpha(250);
    SetGraphicScale(1, 1);
    SetGraphicAngle(0, 0, 0);
    if(GetEnemyLife>2000){SetGraphicRect(0, 44, 47, 75);} //Purple
    if(GetEnemyLife<2000){SetGraphicRect(51, 44, 98, 75);} //Orchid?...
    if(GetEnemyLife<750){SetGraphicRect(102, 44, 149, 75);} //Gray
    }
    DrawGraphic(GetX, GetY);
    m++;
    if(m==30){m=0;}
  }

  @Background{
  }

  @Finalize{
    DeleteGraphic(imgBoss);
  }

  task mainTask{
    wait(90);
    yield;
    movement;
    fire;
  }

  task movement{
    loop{
      SetMovePosition02(GetCenterX+50, GetCenterY-100, 60);
      wait(61);
      SetMovePosition02(GetCenterX, GetCenterY-50, 60);
      wait(61);
      SetMovePosition02(GetCenterX-50, GetCenterY-100, 60);
      wait(61);
      SetMovePosition02(GetCenterX, GetCenterY-150, 60);
      wait(61);
      yield;
    }
  }

  task fire{
    let x = 0;
    let dirf = 0;
    loop{
      while(x<36){
        CreateShotA(5, GetEnemyX+25*cos(dirf), GetEnemyY+25*sin(dirf), 6);
        SetShotDataA(5, 0, 2, dirf, 0.4, 0, 3, WHITE05);
        FireShot(5);
        CreateShotA(5, GetEnemyX+25*cos(dirf), GetEnemyY+25*sin(dirf), 6);
        SetShotDataA(5, 90, 2, dirf, -0.2, 0, 3, WHITE05);
        FireShot(5);
        CreateShotA(5, GetEnemyX+25*cos(dirf), GetEnemyY+25*sin(dirf), 6);
        SetShotDataA(5, 180, 2, dirf, 0.4, 0, 3, WHITE05);
        FireShot(5);
        CreateShotA(5, GetEnemyX+25*cos(dirf), GetEnemyY+25*sin(dirf), 6);
        SetShotDataA(5, 270, 2, dirf, -0.2, 0, 3, WHITE05);
        FireShot(5);
        dirf+=360/36;
        x++;
      }
    x = 0;
    dirf = 0;
    wait(60);
    yield;
    }
  }

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

}
it keeps returning the error below;

It's an issue with brackets. Yes, seriously. Your @DrawLoop has an extra } before the DrawGraphic.
<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.

Lawence Codye

  • The Nine Tails of Subconscious...
  • Come & your desires shall all become reality...
Re: Danmakufu Q&A/Problem Thread II
« Reply #366 on: November 13, 2009, 07:31:10 AM »
It's an issue with brackets. Yes, seriously. Your @DrawLoop has an extra } before the DrawGraphic.

Woah, got to be even more careful with that then I already was...extra bracket,
this is not my day...oh, thanks Blargel seriously, this was killing me mentally...
I am the Nine Tails of Subconscious...

Come & your greatest desires will be reality...

Henry

  • The observer
  • Exploring to the new world of Danmaku
Re: Danmakufu Q&A/Problem Thread II
« Reply #367 on: November 13, 2009, 04:06:41 PM »
What do you mean reflect? Like create a 2nd image next to it being mirrored? Or are you trying to simply flip/mirror a graphic?
I meant just reflect it.
However, when I use the enemy sprite from SA, I cannot rotate the sprite well :(
Old/Forgotten member.

Old Patchouli Project was outdated but new one is in progress.

Helepolis

  • Charisma!
  • *
  • O-ojousama!?
Re: Danmakufu Q&A/Problem Thread II
« Reply #368 on: November 13, 2009, 07:35:23 PM »
I still don't really get it but for mirroring just use the SetGraphicAngle(180,0,0);  to mirror the image.

Fujiwara no Mokou

  • Hourai Incarnate
  • Oh, so this trial of guts is for ME?
    • Profile
Re: Danmakufu Q&A/Problem Thread II
« Reply #369 on: November 14, 2009, 02:57:59 AM »
Alright, so here's a question.

Bullets that are spawned and fired at random times, I want all of them to react to something at once. Such as a timer or something.  Is there a way to do this with CreateShotA's/SetShotDataA's?

Re: Danmakufu Q&A/Problem Thread II
« Reply #370 on: November 14, 2009, 03:07:03 AM »
CreateShotA(0, GetX, GetY, delay);
SetShotDataA(0, 0, speed, angle, 0, 0, 0, RED01);
SetShotDataA(0, (Time to do whatever you want) - delay, speed, angle, 0, 0, 0, RED01);
FireShot(0);

Subtract the difference between the time your first bullet was fired and your last bullet fired too, if you are spawning them on different frames, like this:


let time = 0;
let delay = 20;
loop(10){
   CreateShotA(0, GetX, GetY, delay);
   SetShotDataA(0, 0, 3, 180, 0, 0, 0, RED01);
   SetShotDataA(0, 120 - delay - time, 4, 90, 0, 0, 0, BLUE01);
   FireShot(0);
   time++;
   delay-=2;
   yield;
}

All the bullets will shoot downwards at the same time.

What you're doing is much easier to accomplish with true randomness by using object bullets, however.

Fujiwara no Mokou

  • Hourai Incarnate
  • Oh, so this trial of guts is for ME?
    • Profile
Re: Danmakufu Q&A/Problem Thread II
« Reply #371 on: November 14, 2009, 04:53:09 AM »
Oh wow, thanks. I can make some really nice patterns with this.

puremrz

  • Can't stop playing Minecraft!
Re: Danmakufu Q&A/Problem Thread II
« Reply #372 on: November 14, 2009, 11:54:25 AM »
Brainfart: How do you calculate the distance between two objects again?
I'm making something like SetMovePosition03, but for all objects, not bosses alone.
Full Danmakufu game "Juuni Jumon - Summer Interlude" is done!
By the same person who made Koishi Hell 1,2 (except this game is serious)
Topic: http://www.shrinemaiden.org/forum/index.php/topic,9647.0.html

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 #373 on: November 14, 2009, 01:05:16 PM »
Brainfart: How do you calculate the distance between two objects again?
I'm making something like SetMovePosition03, but for all objects, not bosses alone.

use the pythagorean theorem a^2+b^2=c^2 or in this case
((objaX-objbX)^2+(objaY-objbY)^2)^0.5
Danmakufu Script Thread :V Latest Script: Intertwining Mechanical Intervention (temp name)

Yooooouuutuuuubeeee Channel Latest Video: Contest #8 Entry

puremrz

  • Can't stop playing Minecraft!
Re: Danmakufu Q&A/Problem Thread II
« Reply #374 on: November 14, 2009, 01:45:45 PM »
use the pythagorean theorem a^2+b^2=c^2 or in this case
((objaX-objbX)^2+(objaY-objbY)^2)^0.5

Ah, that helped me indeed (Although someone managed to help me earlier with this), still, thanks for the help. I got it working now, woohoo!
Full Danmakufu game "Juuni Jumon - Summer Interlude" is done!
By the same person who made Koishi Hell 1,2 (except this game is serious)
Topic: http://www.shrinemaiden.org/forum/index.php/topic,9647.0.html

Lawence Codye

  • The Nine Tails of Subconscious...
  • Come & your desires shall all become reality...
Re: Danmakufu Q&A/Problem Thread II
« Reply #375 on: November 14, 2009, 07:36:13 PM »
alright new question...

I want my player to have it's option shots change among more then two styles one at a time
each time I press C(& only if I press C & not otherwise)...I'm even having trouble using the
GetKeyState(VK_USER) function which I don't even know if it will help me here...how do I approach this exactly?
I am the Nine Tails of Subconscious...

Come & your greatest desires will be reality...

Chronojet ⚙ Dragon

  • The Oddity
  • 今コソ輝ケ、我ガ未来、ソノ可能性!!
Re: Danmakufu Q&A/Problem Thread II
« Reply #376 on: November 14, 2009, 09:30:40 PM »
alright new question...

I want my player to have it's option shots change among more then two styles one at a time
each time I press C(& only if I press C & not otherwise)...I'm even having trouble using the
GetKeyState(VK_USER) function which I don't even know if it will help me here...how do I approach this exactly?
if(GetKeyState(VK_USER)==KEY_PUSH) { options++; }
...
if(options==??) { shoot; }
else if(options==???) { shootsomething; }
else { stuff; }
...is how I made my player do that.

Oh wait...
Do you mean "if you are pressing or holding C, make the option do this, otherwise if not not pressing C, do this other thing"?
« Last Edit: November 14, 2009, 09:32:25 PM by Always お⑨烏 »

Helepolis

  • Charisma!
  • *
  • O-ojousama!?
Re: Danmakufu Q&A/Problem Thread II
« Reply #377 on: November 14, 2009, 09:32:41 PM »
Obviously you want to set double statements like 

If(GetKeyState(VK_USER)==KEY_PUSH && GetKeyState(alltheothers)==KEY_FREE) {  do stuff  }

I hope.

Edit:  On wiki: http://touhou.wikia.com/wiki/Touhou_Danmakufu:_Mathematical_or_Information_Functions#GetKeyState

        KEY_FREE: the key is free
        KEY_PUSH: the key is pushed now
        KEY_HOLD: the key is holding
        KEY_PULL: the key is released now
« Last Edit: November 14, 2009, 09:37:00 PM by Helepolis »

Lawence Codye

  • The Nine Tails of Subconscious...
  • Come & your desires shall all become reality...
Re: Danmakufu Q&A/Problem Thread II
« Reply #378 on: November 14, 2009, 09:53:58 PM »
Oh wait...
Do you mean "if you are pressing or holding C, make the option do this, otherwise if not not pressing C, do this other thing"?
...no I do not...a matter of fact, I mean if I press C & then let go...then my forward shot will now be a spread shot...in other words...press C(while forward shot is activated) to then activate spread shot...

Obviously you want to set double statements like

If(GetKeyState(VK_USER)==KEY_PUSH && GetKeyState(alltheothers)==KEY_FREE) {  do stuff }

I hope.


yeah that's what I was doing but inside a task to avoid making task Option(position) or @MainLoop oh my god fucking huge...so, I guess I will ask how to set the above up in a task so that it would work...cause I tried about 3 ways & umm...yeah, no luck...

oh, & I saw the wiki...very clear that I need to type it...like that, but the do stuff part is working me over...
I am the Nine Tails of Subconscious...

Come & your greatest desires will be reality...

Re: Danmakufu Q&A/Problem Thread II
« Reply #379 on: November 17, 2009, 05:30:24 AM »
Mukyu~! my question is...uhh...what was it >_<;!!!!

ah! thats it!

i know i asked about if and while statements earlier, but, in order for it to work, it needs to be something like
if(lalalala){
stuff;
  }else(if( more stuff)){}
right?

Drake

  • *
Re: Danmakufu Q&A/Problem Thread II
« Reply #380 on: November 17, 2009, 05:48:27 AM »
if(lalala){
    stuff;
}else{
    morestuff;
}

or

if(lalala){
    stuff;
}else if(popopo){
    morestuff;
}

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

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 #381 on: November 17, 2009, 12:15:53 PM »
Ok, umm... so I couldn't really understand what azure and fujiwara were saying about bending lines into circles as effect objects, so I thought up of my own way to do it. Problem is... this would probably be just the same thing as they said, and I'm thinking that this would have some flexibility issues too... anyway... I just wanted to ask that this is already technically the basics of it right? (no I didn't take any ideas from anyone, this was just how I thought of doing it)

Code: [Select]
script_enemy_main {

let frame=0;
let cx=GetCenterX();
let circlepic=GetCurrentScriptDirectory~"circlepic.png";
task circle
{
let timera=GetTimer*60; //set the 2 timer variables that deal with the shrinking of the circle
let timerb=GetTimer*60;
let radius=0; //set the radius as 0 because of the growing effect at the start
let radiusstart=150; //set the radius of wanted circle, may be changed to whatever you want
let circlethickness=30; //set the thinkness or width of the circle, may be changed as wanted
let growcounter=0; //set counter
let growtime=60; //set how long the circle would take to grow, may be changed to anything
let x=GetX; //set where the circle would appear
let y=GetY; //set where the circle would appear
let vertexnum=500; //set the number of vertices, may be changed to whatever
let graphendY=256; //set the bottom of the graphic (I put it here for easier understanding)
let graphendX=32; //set the rightmost part of the graphic (I put it here for easier understanding)
let angle=0; //set the starting angle
let rotatespeed=2; //set how fast it rotates

let circle=Obj_Create(OBJ_EFFECT); //create the circle
ObjEffect_SetTexture(circle, circlepic); //set graphic
ObjEffect_CreateVertex(circle, vertexnum+2); //create vertices (the plus 2 is because it won't be a complete circle without it)
ObjEffect_SetPrimitiveType(circle, PRIMITIVE_TRIANGLESTRIP); //set primitive state
ascent(i in 0..vertexnum+2)
{
if(i%2==0){
ObjEffect_SetVertexUV(circle, i, 0, floor(i/2)*((2*graphendY)/vertexnum)); //set locations in the picture (graphendY and graphendX, later, were used to make things clearer)
ObjEffect_SetVertexXY(circle, i, x+radius*cos(floor(i/2)*(720/vertexnum)+angle), y+radius*sin(floor(i/2)*(720/vertexnum)+angle)); //set locations in the game (the center of the circle + the distance in x and y using sine and cosine)
}else{
ObjEffect_SetVertexUV(circle, i, graphendX, floor(i/2)*((2*graphendY)/vertexnum)); //set locations in the picture
ObjEffect_SetVertexXY(circle, i, x+(radius+circlethickness)*cos(floor(i/2)*(720/vertexnum)+angle), y+(radius+circlethickness)*sin(floor(i/2)*(720/vertexnum)+angle));  //set locations in the game

}
}
while(Obj_BeDeleted(circle)==false)
{
yield;
angle+=rotatespeed;
timerb--; //remove if you don't want the circle to shrink
x=GetX; //change to whereever you want the circle to be
y=GetY; //change to whereever you want the circle to be
ascent(i in 0..vertexnum+2)
{
if(i%2==0){
ObjEffect_SetVertexXY(circle, i, x+radius*cos(floor(i/2)*(720/vertexnum)+angle), y+radius*sin(floor(i/2)*(720/vertexnum)+angle)); //set location
}else{
ObjEffect_SetVertexXY(circle, i, x+(radius+circlethickness)*cos(floor(i/2)*(720/vertexnum)+angle), y+(radius+circlethickness)*sin(floor(i/2)*(720/vertexnum)+angle)); //set location
}
}
growcounter++; //handle growing
if(growcounter<=growtime)
{
radius+=radiusstart/growtime; //growth
}else{
radius=radiusstart*(timerb/timera)-1; //shrinking
}
}
}

@Initialize
{
SetLife(1);
SetTimer(60);
LoadGraphic(circlepic);
SetMovePosition02(cx,120,50);
}

@MainLoop{
SetCollisionA(GetX, GetY, 32);
SetCollisionB(GetX, GetY, 16);
frame++;
yield;
if(frame==1)
{
circle;
}
}

@Finalize
{
DeleteGraphic(circlepic);
}

@DrawLoop
{
}
}
« Last Edit: November 17, 2009, 12:26:32 PM by kyle_090594 »
Danmakufu Script Thread :V Latest Script: Intertwining Mechanical Intervention (temp name)

Yooooouuutuuuubeeee Channel Latest Video: Contest #8 Entry

Fujiwara no Mokou

  • Hourai Incarnate
  • Oh, so this trial of guts is for ME?
    • Profile
Re: Danmakufu Q&A/Problem Thread II
« Reply #382 on: November 17, 2009, 05:01:39 PM »
Ok, umm... so I couldn't really understand what azure and fujiwara were saying about bending lines into circles as effect objects, so I thought up of my own way to do it. Problem is... this would probably be just the same thing as they said, and I'm thinking that this would have some flexibility issues too... anyway... I just wanted to ask that this is already technically the basics of it right? (no I didn't take any ideas from anyone, this was just how I thought of doing it)

Code: [Select]
script_enemy_main {

let frame=0;
let cx=GetCenterX();
let circlepic=GetCurrentScriptDirectory~"circlepic.png";
task circle
{
let timera=GetTimer*60; //set the 2 timer variables that deal with the shrinking of the circle
let timerb=GetTimer*60;
let radius=0; //set the radius as 0 because of the growing effect at the start
let radiusstart=150; //set the radius of wanted circle, may be changed to whatever you want
let circlethickness=30; //set the thinkness or width of the circle, may be changed as wanted
let growcounter=0; //set counter
let growtime=60; //set how long the circle would take to grow, may be changed to anything
let x=GetX; //set where the circle would appear
let y=GetY; //set where the circle would appear
let vertexnum=500; //set the number of vertices, may be changed to whatever
let graphendY=256; //set the bottom of the graphic (I put it here for easier understanding)
let graphendX=32; //set the rightmost part of the graphic (I put it here for easier understanding)
let angle=0; //set the starting angle
let rotatespeed=2; //set how fast it rotates

let circle=Obj_Create(OBJ_EFFECT); //create the circle
ObjEffect_SetTexture(circle, circlepic); //set graphic
ObjEffect_CreateVertex(circle, vertexnum+2); //create vertices (the plus 2 is because it won't be a complete circle without it)
ObjEffect_SetPrimitiveType(circle, PRIMITIVE_TRIANGLESTRIP); //set primitive state
ascent(i in 0..vertexnum+2)
{
if(i%2==0){
ObjEffect_SetVertexUV(circle, i, 0, floor(i/2)*((2*graphendY)/vertexnum)); //set locations in the picture (graphendY and graphendX, later, were used to make things clearer)
ObjEffect_SetVertexXY(circle, i, x+radius*cos(floor(i/2)*(720/vertexnum)+angle), y+radius*sin(floor(i/2)*(720/vertexnum)+angle)); //set locations in the game (the center of the circle + the distance in x and y using sine and cosine)
}else{
ObjEffect_SetVertexUV(circle, i, graphendX, floor(i/2)*((2*graphendY)/vertexnum)); //set locations in the picture
ObjEffect_SetVertexXY(circle, i, x+(radius+circlethickness)*cos(floor(i/2)*(720/vertexnum)+angle), y+(radius+circlethickness)*sin(floor(i/2)*(720/vertexnum)+angle));  //set locations in the game

}
}
while(Obj_BeDeleted(circle)==false)
{
yield;
angle+=rotatespeed;
timerb--; //remove if you don't want the circle to shrink
x=GetX; //change to whereever you want the circle to be
y=GetY; //change to whereever you want the circle to be
ascent(i in 0..vertexnum+2)
{
if(i%2==0){
ObjEffect_SetVertexXY(circle, i, x+radius*cos(floor(i/2)*(720/vertexnum)+angle), y+radius*sin(floor(i/2)*(720/vertexnum)+angle)); //set location
}else{
ObjEffect_SetVertexXY(circle, i, x+(radius+circlethickness)*cos(floor(i/2)*(720/vertexnum)+angle), y+(radius+circlethickness)*sin(floor(i/2)*(720/vertexnum)+angle)); //set location
}
}
growcounter++; //handle growing
if(growcounter<=growtime)
{
radius+=radiusstart/growtime; //growth
}else{
radius=radiusstart*(timerb/timera)-1; //shrinking
}
}
}

@Initialize
{
SetLife(1);
SetTimer(60);
LoadGraphic(circlepic);
SetMovePosition02(cx,120,50);
}

@MainLoop{
SetCollisionA(GetX, GetY, 32);
SetCollisionB(GetX, GetY, 16);
frame++;
yield;
if(frame==1)
{
circle;
}
}

@Finalize
{
DeleteGraphic(circlepic);
}

@DrawLoop
{
}
}

Hmmm, it looks a bit chaotic.  My tutorial isn't that hard to understand, is it?
From what I see, you're getting the basics right, but I don't see why you take the long route to do some things, like set the individual X and Y parameters for the circle instead of Obj_SetPosition(id#,GetX,GetY);. It would get some of those annoying variables out of the way.  But aside from those things, you pretty much have it down.  Also, what's that "floor" variable doing there?

Drake

  • *
Re: Danmakufu Q&A/Problem Thread II
« Reply #383 on: November 17, 2009, 05:25:24 PM »
>floor
>variable

wut

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

Re: Danmakufu Q&A/Problem Thread II
« Reply #384 on: November 17, 2009, 08:03:55 PM »
Useful post as always, Drake

floor() is a function that will take whatever number you input in it and round to the integer less than or equal to that number.

floor(3.1) = 3
floor(2) = 2
floor(1.5) = 1
floor(8.99999999) = 8

ceil() works the opposite way, converting to the nearest integer greater than or equal to that number.

ceil(3.1) = 4
ceil(2) = 2
ceil(1.5) = 2
ceil(8.999999999) = 9

round() does exactly what you think it does.

round(3.1) = 3
round(2) = 2
round(1.5) = 2
round(8.99999999) = 9

truncate() or trunc() cuts off (truncates) any decimal portion of a real number, converting it to an integer. It works the exact same way as floor(), pretty much.

trunc(3.1) = 3
trunc(2) = 2
trunc(1.5) = 1
trunc(8.9999999) = 8

The more you know

Edit: weeeee
« Last Edit: November 17, 2009, 10:52:59 PM by Naut »

Blargel

  • RAWR!
  • I'M AN ANGRY LOLI!
Re: Danmakufu Q&A/Problem Thread II
« Reply #385 on: November 17, 2009, 09:07:22 PM »
And by ciel, I'm sure Naut means ceil.
<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 #386 on: November 17, 2009, 10:52:31 PM »
Consider it a fit of stupidity.

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 #387 on: November 18, 2009, 03:18:31 AM »
Hmmm, it looks a bit chaotic.  My tutorial isn't that hard to understand, is it?
From what I see, you're getting the basics right, but I don't see why you take the long route to do some things, like set the individual X and Y parameters for the circle instead of Obj_SetPosition(id#,GetX,GetY);. It would get some of those annoying variables out of the way.  But aside from those things, you pretty much have it down.  Also, what's that "floor" variable doing there?

I put the X and Y variables there to show that it can be placed anywhere and not just on the boss and to show that you can move it around while it exists... floor's there because I only made one ascent, for both the inner and outer vertices of the circle, so the odd numbers will have the same angle as their even pairs.

Where exactly am I making things harder for myself/taking the long route??? I placed most of the variables there just to make things clearer and more flexible without prying in the code too much...
« Last Edit: November 18, 2009, 11:06:55 AM by kyle_090594 »
Danmakufu Script Thread :V Latest Script: Intertwining Mechanical Intervention (temp name)

Yooooouuutuuuubeeee Channel Latest Video: Contest #8 Entry

Re: Danmakufu Q&A/Problem Thread II
« Reply #388 on: November 18, 2009, 04:52:49 AM »
I just realized something.

Usually when you make a script, as you test it, it becomes harder and harder to tell what's a cheap shot and what's not. For instance the random train spell I made is easy enough, but I'm sure if someone randomly picked it up they would be cheapshotted a ton of times because they don't know the pattern.

So what's the solution? In order to pick out these things and properly balance these things, you'd have put your mind into a state where you won't remember exactly what you made and won't be alert to these things.

In other words.






:V The secret to everything :V

Helepolis

  • Charisma!
  • *
  • O-ojousama!?
Re: Danmakufu Q&A/Problem Thread II
« Reply #389 on: November 18, 2009, 11:05:27 AM »
Drake, I didn't understand a thing of the spellcircle slingshot effect code. Therefor reasking it again =.=. I am a failure in math so this is the following I want to achieve by math (else I could take the long road)

- My spellcircle has starting size: 80.
- I want it to grow to 180 with an accelerating speed.
- When it reaches close to 180 I want it to deaccelerate
- At size 180 it should start shrinking with acceleration untill it reaches it's final size: 150

HOW ?!
« Last Edit: November 18, 2009, 11:27:44 AM by Helepolis »