~Hakurei Shrine~ > Rika and Nitori's Garage Experiments
Danmakufu Basics Tutorial! (Blargel)
Naut:
Firing and Controlling Lasers
So by now, you should know how the functions work in Danmakufu as well as what I mean by certain terms. Hopefully this will save time when I try to explain things...
* Blargel is just talking to himself.
Lasers are fired quite similarly to bullets. Except for the more complicated ones, they behave almost exactly like elongated bullets. They even use the same bullet graphics by stretching them to fit the lengths and widths that you specify. There are four types of laser available in Danmakufu: CreateLaser01, CreateLaserA, CreateLaserB, and CreateLaserC. That's right: there's only one type of laser that is relatively simple to control.
CreateLaser01
This creates a laser that shoots at a specified angle at a specified speed. Once the laser exits the screen, it is deleted. It's like the lasers in Cirno's second non-spellcard attack in Embodiment of Scarlet Devil. The parameters for it are starting x-coordinate, starting y-coordinate, speed, angle, length, width, graphic, and delay. 8 parameters total. CreateLaser01(GetX, GetY, 2, GetAngleToPlayer, 200, 16, RED01, 20); would create a laser that starts at the boss's position, moves at 2 pixels per frame at the player, is 200 pixels in length and 16 pixels in width, is drawn with the small red bullet graphic, and is delayed for 20 frames.
CreateLaserA
Now for the fun complicated lasers. This laser is the type that, when delayed, has a thin line that shows where the laser will show up. It has no speed and instead covers the whole line. Think of Keine's Last Spell in Imperishable Night for an example. If you understood how CreateShotA worked, then this should be easy to understand as well. CreateLaserA is controlled by SetLaserDataA, SetShotKillTime, FireShot, and AddShot.
CreateLaserA has 7 parameters: ID number, starting x-coordinate, starting y-coordinate, length, width, graphic, and delay. For example, if you write CreateLaserA(1, GetX, GetY, 400, 20, YELLOW01, 60); you will initialize a laser with an ID of 1, whose base is positioned at the boss's position, with a length of 400 pixels and width of 20 pixels, with bullet graphic of a small yellow bullet, and a delay of 60 frames.
SetLaserDataA also has 7 parameters: ID number, time after creation to affect the laser, firing angle, firing angular velocity, change in length, moving speed of the base, and moving angle of the base. For example, SetLaserDataA(1, 0, 0, 1, -1, 2, 180); will cause the laser with ID of 1 to, 0 frames after its creation (immediately), aim straight right but turn at 1 degree per frame, shrink by one pixel per frame, and move to the left at 2 pixels per frame. Note that the second parameter measures frames from creation instead of frames from firing. This means that if you create a laser with a delay of 60, and tell it with this function to move, it will actually start moving even while it is delayed.
The other three functions have already been explained in the previous section and stringing them all together as a whole has also already been demonstrated there too. Therefore, I'm going to move on to CreateLaserB
CreateLaserB
This laser works almost the same as CreateLaserA, but the position of the base is controlled a little differently. The position of the base is determined by the position of the boss, so in a way, they are installed on the boss. When delayed, has a thin line that shows where the laser will show up. Think of Flandre's Laevantein in Embodiment of Scarlet Devil for an example. CreateLaserB is controlled by SetLaserDataB, SetShotKillTime, FireShot, and AddShot.
CreateLaserB has five parameters: ID number, length, width, graphic, and delay. CreateLaserB(2, 300, 32, RED01, 120); will initialize a laser with an ID of 2, a length of 300, a width of 32, a graphic of a small red bullet, and a delay of 120 frames (2 seconds).
SetLaserDataB has nine parameters: ID number, time after creation to modify laser, change in length, distance from the boss to the laser base, change in distance from the boss to the laser base, angle from the boss to the laser base, change in angle from the boss to the laser base, firing angle, and change in firing angle. As a useful example (for once), this will cause the laser to rotate around the boss in a circle with radius of 100, pointing outwards at all times: SetLaserDataB(0, 0, 0, 100, 0, 0, 2, 0, 2);. This makes the laser start pointing to the right and rotate clockwise around the boss, keeping a constant length and distance from the boss. Keep in mind that even if the boss moves, the laser will move with it to continue circling her.
Again, please check the section of ShotA bullets to learn about the other three functions.
CreateLaserC
These lasers are usually seen only in Perfect Cherry Blossom, namely against Letty Whiterock or Merlin Prismriver. I'm talking about those annoying curving lasers... or at least they're annoying when Merlin uses them. These lasers are very heavy on the processor so use them sparingly (i.e. don't have fifty of them out at once). However, if you've mastered controlling ShotAs and LaserAs, this will be really easy for you to use. The parameters for CreateLaserC are exactly the same as those of CreateLaserA and the parameters for SetLaserDataC are exactly the same as those of SetShotDataA. In other words, LaserCs are pretty much ShotAs with a tail following them.
I don't think I need to explain them because they are exactly the same. Just the names are different. If I'm wrong and someone does need explaining, then just PM me or contact me in some other way. I'll edit in some explanations.
AddShot with Lasers
As mentioned in the previous section about ShotA bullets, AddShot has a fourth parameter that determines how far down from the laser base the added bullet should spawn from. An example of why this might be used can be seen from Flandre's Laevantein attack, which spawns bullets at equal intervals along the bullet as it moves. Here's a snippet of code as an example of how this will be used.
--- Code: ---CreateLaserA(0, GetX, GetY, 300, 20, YELLOW01,0);
SetLaserDataA(0, 0, 0, 2, 0, 0, 0);
SetShotKillTime(0, 90);
ascent(i in 0..30){
ascent(j in 0..20){
CreateShotA(1, 0, 0, 10);
SetShotDataA(1, 0, 0, 90, 0, 0.1, 3, YELLOW11);
AddShot(i*3, 0, 1, j*15);
}
}
FireShot(0);
--- End code ---
If you run this part of a script in an actual script, it should create a laser that turns and spawns bullets from it at equal intervals. You'll notice, though, that though I set the bullets to shoot at 90 degrees, or straight down, they are instead being fired 90 degrees to the laser. Keep this in mind when adding bullets to lasers. Lasers can also be added to lasers with the same result.
Other Notes
Again, there are such things as object lasers but those are too advanced for a "Basic Tutorial". I'll leave it to someone else to explain them... or maybe me when I get time again.
Naut:
End quote. Hope you enjoyed reading what Blargel completed of his tutorial. I know it was an invaluable resource when I was first starting to learn Danmakufu.
Blargel has a Danmakufu-specific YouTube channel (which is dead, but might prove to be worth a look): http://www.youtube.com/user/DanmakufuBlargel
His current YouTube channel doesn't focus on Danmakufu at all, but he checks it fairly often so you can take a look at it as well: http://www.youtube.com/user/Blargel?blend=2&ob=1
Suikama:
Random note. All PlayLevel does it put whatever string you have in the brackets under your point count. It's only for noting the level difficulty, but you can put whatever you want there as well (like Donatic lol)
On another random note: I just started learning this now :V
Edit: 28!=2 is false?
Naut:
Fixed. Didn't bother reading through this, just copied Blargel's direct words. Looking forward to another Danmakufu scripter~.
Dingzhu:
Sorry for being a noob at scripting (and if I'm necroposting or anything like that. :V)
But I'm a bit confused about this code.
--- Quote ---CreateShotA(1, GetX, GetY, 10);
SetShotDataA(1, 0, 5, 0, 2.2, 0, 5, RED03);
SetShotDataA(1, 60, 5, 132, 0, 0.1, 8, RED03);
ascent(i in 1..60){
CreateShotA(2, 0, 0, 30);
SetShotDataA_XY(2, 0, rand(-1, 1), rand(-1, -4), 0, 0.1, 0, 3, RED01);
AddShot(i*2, 1, 2, 0);
}
FireShot(1);
--- End quote ---
What exactly does the "rand" mean? Random? I can't seem to figure any of it out. :/