Author Topic: Danmakufu Q&A/Problem thread number 4  (Read 205977 times)

Re: Danmakufu Q&A/Problem thread number 4
« Reply #120 on: July 11, 2010, 09:37:24 AM »
Code: [Select]
[quote]
let yratio2=(GetX-GetClipMaxX)/((GetX-GetClipMaxX)+(GetPlayerX-GetClipMaxX));
let ypoint2=GetY+(ydist*yratio2);
let angle2=atan2(ypoint2-GetY,GetClipMaxX-GetX);
let pointdist2=((GetX-GetClipMaxX)^2)+((GetY-ypoint2)^2);
let pointdist2=pointdist2^0.5;
let pointdist2=floor(pointdist2/2);

Stuffman's code for the right wall

空SoraのNo鏡Kagami

  • Wolven Wind Warrior of the West (That's catchy)
  • Occupation: Hopeless Amazing Young Scriptor
Re: Danmakufu Q&A/Problem thread number 4
« Reply #121 on: July 14, 2010, 09:15:25 PM »
Ugh...  Can anyone tell me exactly how Shot replacement works? I can't seem to find anything on it...
Me: Rapture is comin'
Person: OMG WHEN!
Me: Naow, APOCALYPSE SIGN "RAPTURE"!

Re: Danmakufu Q&A/Problem thread number 4
« Reply #122 on: July 14, 2010, 09:36:55 PM »
Shot Replacement works by using #include_function "pathname of .txt" to make it easier to catorgorize shots.

when making Shot Data you give the bullets an ID, calling this ID calls that bullet's graphic with the ID of the one called, but it is possible to "replace" this ID with something easier, such as RED01, BLUE02, GREEN22 etc. etc.

Does that clear that up?

空SoraのNo鏡Kagami

  • Wolven Wind Warrior of the West (That's catchy)
  • Occupation: Hopeless Amazing Young Scriptor
Re: Danmakufu Q&A/Problem thread number 4
« Reply #123 on: July 14, 2010, 09:47:37 PM »
I think what i was trying to say was... How would you put it into the code... It confuses me,,,
Me: Rapture is comin'
Person: OMG WHEN!
Me: Naow, APOCALYPSE SIGN "RAPTURE"!

Re: Danmakufu Q&A/Problem thread number 4
« Reply #124 on: July 14, 2010, 09:54:20 PM »
you would use

#include_function"pathname to the shot_replace.txt"

it doesn't have to be named shot_replace.txt, but thats just an example

Zerro

  • ERRORS,
  • ERRORS EVERYWHERE
Re: Danmakufu Q&A/Problem thread number 4
« Reply #125 on: July 15, 2010, 03:55:06 AM »

Gargh! I'm still confused!


GetPlayerScriptName and USER_PLAYER confuse me to no end.  :(
How do you use them? How do you use them for multiple characters?
Life's a shmup, play on lunatic.

Re: Danmakufu Q&A/Problem thread number 4
« Reply #126 on: July 15, 2010, 04:03:41 AM »
GetPlayerScriptName works by getting the name of the player script that the player is currently using.
for example
if(GetPlayerScriptName == enter_name_of_player.txt){ SetStuff; DoStuff; Whatever;}
note, that you will need to know the name of the player script before hand.

USER_PLAYER, I have no idea what that does

Chronojet ⚙ Dragon

  • The Oddity
  • 今コソ輝ケ、我ガ未来、ソノ可能性!!
Re: Danmakufu Q&A/Problem thread number 4
« Reply #127 on: July 15, 2010, 04:11:01 AM »
USER_PLAYER, I have no idea what that does

USER_PLAYER is for a Player Script, for example, "Rumia.txt"

Zerro

  • ERRORS,
  • ERRORS EVERYWHERE
Re: Danmakufu Q&A/Problem thread number 4
« Reply #128 on: July 15, 2010, 04:34:58 AM »
GetPlayerScriptName works by getting the name of the player script that the player is currently using.
for example
if(GetPlayerScriptName == enter_name_of_player.txt){ SetStuff; DoStuff; Whatever;}
note, that you will need to know the name of the player script before hand.

USER_PLAYER, I have no idea what that does

Thanks, it's working now ^_^
Life's a shmup, play on lunatic.

Re: Danmakufu Q&A/Problem thread number 4
« Reply #129 on: July 17, 2010, 12:14:13 PM »
How to make screen Shake  :o ? Like when you use master spark
Hey There !

Iryan

  • Ph?nglui mglw?nafh
  • Cat R?lyeh wgah?nagl fhtagn.
Re: Danmakufu Q&A/Problem thread number 4
« Reply #130 on: July 17, 2010, 12:18:48 PM »
How to make screen Shake  :o ? Like when you use master spark
There is a command in danmakufu that does that, but I believe it screwed up replays and various other things.

So you best bet is to make every bullet an object bullet (not effect object, what was I thinking when I wrote that?!), then declare a global angular variable that gets set to a random angle each 3 frames or so and have each bullet, the player and the bullets move in the direction of that variable.

To prevent the shaking from occasionally drifting everything in one direction, I'd advise to use shakeangle+=rand(120, 240); for the shaking randomization.
« Last Edit: July 17, 2010, 02:26: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."

Grumskiz

  • Likes Tyrian and Cave...also there is Touhou
  • Danmaku without programming or gaming skill
    • My Youtube Channel - German Let's Play Videos
Re: Danmakufu Q&A/Problem thread number 4
« Reply #131 on: July 17, 2010, 05:18:30 PM »
Hey,
I'm very new to Danmakufu and I have a problem with my @BackGround loop.
I started making my first boss some weeks ago with my first spellcard.
In this spellcard my background image shows up just fine.(It is a placeholder btw...I'm still looking for other bg pictures)
After I finished this spell I decided to make a non-spell like a prequel and to combine these scripts in a plural script.
I copied the whole code and delete some things like SetScore and CutIn but I didn't change any variablenames or values or code in the @DrawLoop or the @BackGround loop.
But the graphics (both bg and enemygraphics) didn't work anymore.
I was able to get the enemygraphics to work again through recoding it completely and changing some things, but I couldn't get the bg to work. (It just shows the standart bg in Danmakufu)
Is there a bug in Danmakufu, which causes the Graphicfunctions to screw up, when you use them in a single script without calling SetScore and/or CutIn or did I make a mistake?

Some code:

At first the @DrawLoop from the first, real spellcard (I left out the variables, because the values didn't change and I checked them three times):
Quote
    @DrawLoop {                     
         
         SetTexture(imgBoss);
         SetRenderState(ALPHA);
         SetAlpha(255);
         SetGraphicScale(0.6,0.6);
         if(int(GetSpeedX())==0) {
            if(f<=10)         { SetGraphicRect(0,0,35,120); }
            if(f>10 && f<=20) { SetGraphicRect(39,0,74,120); }
            if(f>20 && f<=30) {SetGraphicRect(78,0,113,120); }
            f2=0;
         
         
         }
         
         if(GetSpeedX()>0) {          
         
            if(f2<=5)         { SetGraphicRect(170,0,220,120); }
            if(f2>=5) { SetGraphicRect(222,0,279,120); }
            f2++;
         
         
         
         }
         
         if(GetSpeedX()<0) {            
            SetGraphicAngle(180,0,0);
            if(f2<=5)         { SetGraphicRect(170,0,220,120);
            DrawGraphic(GetEnemyX, GetEnemyY);
                                                            }
            if(f2>=5) { SetGraphicRect(222,0,279,120);
            DrawGraphic(GetEnemyX, GetEnemyY);
                                             }
            
            f2++;
         
         
         
         }
         
         
         
         
         
         
         
         
         
         DrawGraphic(GetX,GetY);
         
         f++;
         if(f == 30){f=0;}
   
   
   }

   
    @BackGround {                  
   
         SetTexture(bg);
         SetRenderState(ALPHA);
         SetAlpha(255);
         SetGraphicRect(0,0,500,333);
         SetGraphicScale(1,1);
         SetGraphicAngle(0,0,0);
         DrawGraphic(GetCenterX, GetCenterY);
      
   }




Now the code from the "prequel-non-spell" (How do you call it??):

Quote
  @DrawLoop {                     
         
         SetTexture(imgBoss);
         SetRenderState(ALPHA);
         SetAlpha(255);
         SetGraphicScale(0.6,0.6);
         if(int(GetSpeedX())==0) {
         SetGraphicAngle(0,0,0);
            if(f<=10)         { SetGraphicRect(0,0,35,120); }
            if(f>10 && f<=20) { SetGraphicRect(39,0,74,120); }
            if(f>20 && f<=30) {SetGraphicRect(78,0,113,120); }
            f2=0;
         
         
         }
         
         if(GetSpeedX()>0) {          
         SetGraphicAngle(0,0,0);
            if(f2<=5)         { SetGraphicRect(170,0,220,120); }
            if(f2>=5) { SetGraphicRect(222,0,279,120); }
            f2++;
         
         
         
         }
         
         if(GetSpeedX()<0) {         
            SetGraphicAngle(180,0,0);
            if(f2<=5)         { SetGraphicRect(170,0,220,120);
            DrawGraphic(GetEnemyX, GetEnemyY);
                                                            }
            if(f2>=5) { SetGraphicRect(222,0,279,120);
            DrawGraphic(GetEnemyX, GetEnemyY);
                                             }
            
            f2++;
         
         
         
         }
         
         
         DrawGraphic(GetX,GetY);
         
         f++;
         if(f == 30){f=0;}
   
   
   }

   
    @BackGround {                  
   
         SetTexture(bg);
         SetRenderState(ALPHA);
         SetAlpha(255);
         SetGraphicRect(0,0,500,333);
         SetGraphicScale(1,1);
         SetGraphicAngle(0,0,0);
         DrawGraphic(GetCenterX, GetCenterY);
      
   }

As you can see, I had to change the code in the @DrawLoop to get it work properly. How do I get the background to work?


My apologies for my bad english. I'm german and I learned it at school...

Grums

Re: Danmakufu Q&A/Problem thread number 4
« Reply #132 on: July 17, 2010, 05:35:28 PM »
@BackGround does not work in Non-Spells, @BackGround only functions when there is SetScore. Copy Paste everything in @BackGround and put it in @DrawLoop

Re: Danmakufu Q&A/Problem thread number 4
« Reply #133 on: July 17, 2010, 05:39:26 PM »
There is a command in danmakufu that does that,

Just for fun what's the command though  :V ?
Hey There !

Grumskiz

  • Likes Tyrian and Cave...also there is Touhou
  • Danmaku without programming or gaming skill
    • My Youtube Channel - German Let's Play Videos
Re: Danmakufu Q&A/Problem thread number 4
« Reply #134 on: July 17, 2010, 05:46:04 PM »
Thanks a lot Demonbman.
Now the background works also in non-spells.
But why do I need to change the code in the Drawloop? Also because my script has no SetScore?
Thats pretty annoying for those who want to create their own bosses in Danmakufu   :(

Re: Danmakufu Q&A/Problem thread number 4
« Reply #135 on: July 17, 2010, 05:54:43 PM »
But why do I need to change the code in the Drawloop? Also because my script has no SetScore?
Thats pretty annoying for those who want to create their own bosses in Danmakufu   :(

Well, most people use Stage Scripts to host the background. And yes, @BackGround is IGNORED when there is no SetScore

Grumskiz

  • Likes Tyrian and Cave...also there is Touhou
  • Danmaku without programming or gaming skill
    • My Youtube Channel - German Let's Play Videos
Re: Danmakufu Q&A/Problem thread number 4
« Reply #136 on: July 17, 2010, 06:18:22 PM »
Damn I knew it would happen...my english sucks -.-
My last question was intended to be like this one, but I messed it up, so you understood it wrong (I don't blame you...it was my fault):
Why did I also have to change the code for the bossgraphic (not the background) in the Drawloop?

Re: Danmakufu Q&A/Problem thread number 4
« Reply #137 on: July 17, 2010, 07:10:19 PM »
Damn I knew it would happen...my english sucks -.-
My last question was intended to be like this one, but I messed it up, so you understood it wrong (I don't blame you...it was my fault):
Why did I also have to change the code for the bossgraphic (not the background) in the Drawloop?


I have no idea why you would have to do that, unless you had two variables, or you used the same variable twice, I see no reason why you would have to do that.

ganon2310

Re: Danmakufu Q&A/Problem thread number 4
« Reply #138 on: July 18, 2010, 02:06:14 AM »
HOW DO I MAKE A FAMILAIR FOR MY GAME CHARACTER!?
 :3

Re: Danmakufu Q&A/Problem thread number 4
« Reply #139 on: July 18, 2010, 02:15:54 AM »
Didn't you read the sticky? Look for Stuffman's Player Tutorial, he has it explained in there

ganon2310

Re: Danmakufu Q&A/Problem thread number 4
« Reply #140 on: July 18, 2010, 02:20:07 AM »
i did and he assumed that we already knew how to make and option. i dont.

Re: Danmakufu Q&A/Problem thread number 4
« Reply #141 on: July 18, 2010, 02:23:31 AM »
5th Code Box from the post, look at it, it even says optionX and optionY for your convience.

electron9186

Re: Danmakufu Q&A/Problem thread number 4
« Reply #142 on: July 18, 2010, 03:13:39 AM »
Ganon, i know you're basing your character somewhat off the tutorial's Sakuya A, so here's some hopefully relevant code. It's the option task from the script. Modify as neccessary.

Code: [Select]
task Option(position){
let objoption=Obj_Create(OBJ_EFFECT);
Obj_SetAlpha(objoption,200);
ObjEffect_SetTexture(objoption,img_sakuya);
ObjEffect_SetRenderState(objoption,ALPHA);
ObjEffect_SetPrimitiveType(objoption,PRIMITIVE_TRIANGLEFAN);
ObjEffect_CreateVertex(objoption,4);
ObjEffect_SetVertexUV(objoption,0,145,1);
ObjEffect_SetVertexUV(objoption,1,159,1);
ObjEffect_SetVertexUV(objoption,2,159,15);
ObjEffect_SetVertexUV(objoption,3,145,15);
if(position=="LEFT"){
while(!Obj_BeDeleted(objoption)){
ObjEffect_SetVertexXY(objoption,0,GetPlayerX-optionxpos-8,GetPlayerY+optionypos-7);
ObjEffect_SetVertexXY(objoption,1,GetPlayerX-optionxpos+6,GetPlayerY+optionypos-7);
ObjEffect_SetVertexXY(objoption,2,GetPlayerX-optionxpos+6,GetPlayerY+optionypos+7);
ObjEffect_SetVertexXY(objoption,3,GetPlayerX-optionxpos-8,GetPlayerY+optionypos+7);
if(GetKeyState(VK_SLOWMOVE)==KEY_PUSH || GetKeyState(VK_SLOWMOVE)==KEY_HOLD){
if(count%6 == 3){
JackTheRipper(GetPlayerX-optionxpos-1,GetPlayerY+optionypos-8,12);
}
}else{
if(count%8 == 4){
i=-2;
while(i<=2){
CreatePlayerShot01(GetPlayerX()-optionxpos-1, GetPlayerY()+optionypos-8, 10, 254+(i*8), 1.5, 1, 2);
i++;
}
}
}
yield;
}
}else{
while(!Obj_BeDeleted(objoption)){
ObjEffect_SetVertexXY(objoption,0,GetPlayerX+optionxpos-7,GetPlayerY+optionypos-7);
ObjEffect_SetVertexXY(objoption,1,GetPlayerX+optionxpos+7,GetPlayerY+optionypos-7);
ObjEffect_SetVertexXY(objoption,2,GetPlayerX+optionxpos+7,GetPlayerY+optionypos+7);
ObjEffect_SetVertexXY(objoption,3,GetPlayerX+optionxpos-7,GetPlayerY+optionypos+7);
if(GetKeyState(VK_SLOWMOVE)==KEY_PUSH || GetKeyState(VK_SLOWMOVE)==KEY_HOLD){
if(count%6 == 3){
JackTheRipper(GetPlayerX+optionxpos,GetPlayerY+optionypos-8,12);
}
}else{
if(count%8 == 4){
i=-2;
while(i<=2){
CreatePlayerShot01(GetPlayerX()+optionxpos, GetPlayerY()+optionypos-8, 10, 286+(i*8), 1.5, 1, 2);
i++;
}
}
}
yield;
}
}
}

ganon2310

Re: Danmakufu Q&A/Problem thread number 4
« Reply #143 on: July 18, 2010, 03:18:50 AM »
electron, how do i test if it worked?
 :3

electron9186

Re: Danmakufu Q&A/Problem thread number 4
« Reply #144 on: July 18, 2010, 03:30:43 AM »
 :/

Good question. I don't think we'll be able to even get your character to work until we code the rest of the nonsense for its file.

This is going to take a while...  :(

GenericTouhouFailure

  • WHAT DO YOU MEAN IT'S NOT CALLED UNL? *boom*
Re: Danmakufu Q&A/Problem thread number 4
« Reply #145 on: July 18, 2010, 12:35:09 PM »
Stupid question: Does Obj_SetSpeed and Obj_SetAngle work for obj Effects?

Chronojet ⚙ Dragon

  • The Oddity
  • 今コソ輝ケ、我ガ未来、ソノ可能性!!
Re: Danmakufu Q&A/Problem thread number 4
« Reply #146 on: July 18, 2010, 01:52:26 PM »
Stupid question: Does Obj_SetSpeed and Obj_SetAngle work for obj Effects?

I'm not sure about Obj_SetSpeed, but I'm sure ObjEffect_SetAngle is supposed to be used instead for effects.

Azure Lazuline

  • Looooove!!
  • PM me for free huggles and love!
    • Entanma Project - indie game development
Re: Danmakufu Q&A/Problem thread number 4
« Reply #147 on: July 18, 2010, 02:19:45 PM »
ObjEffect_SetAngle changes the angle of the graphic, while Obj_SetAngle changes the angle of movement. Yes, Obj_SetSpeed works with effect objects.

GenericTouhouFailure

  • WHAT DO YOU MEAN IT'S NOT CALLED UNL? *boom*
Re: Danmakufu Q&A/Problem thread number 4
« Reply #148 on: July 19, 2010, 08:49:55 AM »
ObjEffect_SetAngle changes the angle of the graphic, while Obj_SetAngle changes the angle of movement. Yes, Obj_SetSpeed works with effect objects.
Thanks.

Now if I want my effect object to hurt the player should I use SetCollisionB or what?

Iryan

  • Ph?nglui mglw?nafh
  • Cat R?lyeh wgah?nagl fhtagn.
Re: Danmakufu Q&A/Problem thread number 4
« Reply #149 on: July 19, 2010, 10:33:56 AM »
Thanks.

Now if I want my effect object to hurt the player should I use SetCollisionB or what?

if( ( (GetPlayerX-Obj_GetX(obj))^2 + (GetPlayerY-Obj_GetX(obj))^2 )^0.5 < radius of the object){ CreateShot01(GetPlayerX, GetPlayerY, 0, 90, WHITE05, 0); }


Or something like that.
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."