~Hakurei Shrine~ > Rika and Nitori's Garage Experiments
I just started using Danmakufu,
Cabblecorento:
I changed it to purple, but now it just fires 4 then stops.
Stuffman:
I'm not quite sure what you're trying to accomplish with frame and frame2. What do they start at? In any case, the bullets only fire if frame=frame2, and since frame constantly goes up but frame2 alternates between 10 and 9, they'll only be equal at one point in the script.
Also 1,1 is an odd place to fire bullets from, that's just the upper left corner. The rest are just going offscreen.
Cabblecorento:
--- Quote from: Stuffman on May 12, 2009, 11:15:47 PM ---I'm not quite sure what you're trying to accomplish with frame and frame2. What do they start at? In any case, the bullets only fire if frame=frame2, and since frame constantly goes up but frame2 alternates between 10 and 9, they'll only be equal at one point in the script.
Also 1,1 is an odd place to fire bullets from, that's just the upper left corner. The rest are just going offscreen.
--- End quote ---
I guess I should have put the rest of the script...
Anyways, the idea was that as time went past, the bullets started to fire more rapidly, and then they'd be firing every sixth of a second. It'd also be firing from both corners.
Anyways, I decided to completely remake it.
Now it shoots them randomly, so your dodging to main fast bullets, while having to weave through many slower bullets.
It's also my first thing that can even be called anything close to a spellcard.
Any idea how to make text boxes? ><
Naut:
Text boxes? Hmm, could be referring to two things. Do you want to start an Event (where the player and the boss talk to eachother, as per all Touhou game bosses) or do you just want text to be displayed somewhere in the gaming window?
I'll explain the latter first, since it's much easier to code.
To just draw a bit of text anywhere on the screen, you'll need to call the following function in @DrawLoop, in which you'll declare the text you want to be shown, as well as it's size, opacity and coordinates:
DrawText("Text you want to be displayed", x-coordiante, y-coordinate, text size (12 is a nice standard), alpha value);
That's five parameters. The first is what you want to be displayed, in quotations if it's a text string. The second and third parameters are the text's x and y coordinates, respectively. The fourth parameter is the text's size, for which 12 is a nice standard, though it can be bigger or smaller. The final parameter is it's alpha value or opacity. That is, how deep you want it to be coloured. 255, the maximum value you can put in, is solid and you will see nothing through the text, but bullets can pass above it. 0 is completely see-through, and will thus appear invisible, so you probably don't want to put 0 as the last paramter. ~150 or so is about half see-through, so you'll see the background through the text a bit, but still be able to read the text.
In order for this function to work, you need to draw it every frame. So if you want it to be drawn for the whole duration of a spellcard, just call it in @DrawLoop and leave it alone (because @DrawLoop is run every frame, it will cause the text to be drawn every frame). If you want it to be displayed after a certain amount of time, just make a variable increment every drawloop (like drawcounter++; or something) and say:
if(drawcounter>=120){
DrawText(...);
}
Which will have the text drawn after two seconds (120 frames) have passed. You know what to do, anyway, for whatever effect you're looking for.
Alrighty, for event scripts, you're gonna have to go beyond "script_enemy_main{}" inside of a spellcard and write the following:
--- Code: ---script_event name{
@Initialize{
[Load all your graphics and foolishness here]
}
@MainLoop{
SetChar(LEFT, [player graphic]); //Set the player's character on the left side, with the graphic you've told it to display.
SetGraphicRect(LEFT, [left-side], [top-side], [right-side], [bottom-side]); //The region you're displaying of the graphic for the player character.
MoveChar(LEFT, BACK) //Move the player's character into the background, to show she is not speaking.
SetChar(RIGHT, [enemy's grahic]); //Set the boss' picture on the right side of the screen.
SetGraphicRect(RIGHT, 0, 0, 200, 350); //Set the boundry of the picture you want displayed.
MoveChar(RIGHT, FRONT); //Move the boss' image to the front to show that she is speaking.
TextOutA("The text you want the character to speak goes here"); //Self explanatory. Danmakufu will not pass this function until a certain amount of time has passed, or the player clicks the shot button.
MoveChar(RIGHT, BACK): //Move the boss to the background, then...
MoveChar(LEFT, FRONT); //Move the player forward, to show that she will now speak.
TextOutA("More words here"); //What the player will be speaking.
End; //This ends the event.
}
@Finalize{
[delete all your graphics here]
}
}
--- End code ---
Keep in mind that anything after "//" in Danmakufu is a comment and will not be processed, so I can explain the functions as they appear in the code.
To initialize the event, call in your script:
CreateEventFromScript("name");
Which will tell Danmakufu to look in the current file for an event script called "name", then run it. There are other functions and options, such as coloured speech and whatnot, which are defined and explained here.
As you can see, it's a massive amount of code for a very small effect. I would highly recommend NOT trying to tackle event scripts until you've had a lot of experience with Danmakufu and Stage Scripts, which are primarily where events are called from. So if you're looking to make text boxes or whatever, try to make do with the DrawText function.
Cabblecorento:
Another question. (They just keep coming.)
How would I be able to make it so that bullets go towards one position, then after a certain amount of time, make more bullets and spread out?
Then I probably won't have many more questions.