# Sparen's Danmakufu ph3 Tutorials Extra Lesson 3 - Recollection: Border of Wave and Particle

The video for this lesson (and all extra lessons) is a video of the spell we will be replicating. In this case, it is, as you have probably realized by now, Border of Wave and Particle (BoWaP).

## Part 1: What will be Covered in this Lesson?

In this lesson, I will be explaining how to recreate Border of Wave and Particle, one of the most well-known, most abused, and most infamous patterns in all of Touhou history. We will begin with a brief introduction on what the pattern is, as well as how you can manipulate sine and cosine waves, and will them proceed to replicate it before I explain potential applications (and pitfalls) of this technique.

## Part 2: What is Border of Wave and Particle?

In the history of Touhou, there has been no other pattern so reused, repurposed, and spammed as BoWaP. Unlike standard patterns such as circles and rings that act as components of attacks, BoWaP is often standalone, resulting in repetitive and iconic attacks such as Satori's blindspot.

However, we will put that aside until the end of this lesson and focus on how the pattern actually works.

Basically, we will take advantage of the oscillatory nature of sine and cosine to make a pattern that will oscillate back and forth while providing ample coverage of the screen as well as fair, somewhat easy to dodge gaps. There are multiple ways to implement the pattern. The way I will cover will only involve changing the angle.

## Part 3: How do I Replicate Border of Wave and Particle?

Time to replicate!

``````    task BoWaP{
let angleT = rand(0, 360);
let objcount = 0;
loop{
loop(5){
let obj = CreateShotA1(ObjMove_GetX(objBoss), ObjMove_GetY(objBoss), 3, angleT, 610, 5);
angleT += 360/5;
}
//increment angle here
objcount++;
yield;
}
}``````

Above is our starting code. We'll create an angle variable, and then have an infinite loop where we have a ring of five bullets spawning. As is, our code just belches five lines of bullets from the boss's location. So we need to do some upgrades. Since we know that we want our thing to oscillate, all we need to do is add something that naturally oscillates - sine! We'll add this to our angle

``````    task BoWaP{
let angleT = rand(0, 360);
let objcount = 0;
loop{
loop(5){
let obj = CreateShotA1(ObjMove_GetX(objBoss), ObjMove_GetY(objBoss), 3, angleT, 610, 5);
angleT += 360/5;
}
angleT += sin(objcount) * 6; //BOWAP
objcount++;
yield;
}
}``````

Congratulations. You have just replicated Border of Wave and Particle. The *6 is to make sure that the gaps are large enough to dodge through. Experiment with the values!

Since you can add sines and cosines and do all kinds of other stuff, why stop here? Let's add other things onto the pattern!

``````    task BoWaP2{
let angleT = rand(0, 360);
let objcount = 0;
loop{
loop(5){
let obj = CreateShotA1(ObjMove_GetX(objBoss), ObjMove_GetY(objBoss), 3, angleT, 610, 5);
angleT += 360/5;
}
angleT += sin(objcount) * cos(objcount) * 12; //BOWAP
objcount++;
yield;
}
}``````

Combining multiple oscillatory functions will do all kinds of interesting things. And now, the sorrowful conclusion of this lesson.

## Part 4: What are the Applications of BoWaP?

It is now time to bring this lesson to a close, and I will describe the applications and pitfalls of BoWaP. First and foremost, this pattern is immediately recognizable, and people can and will tell you that you're being extremely unoriginal. Yes, ZUN has used BoWaP before and we've all rolled our eyes at some point during Subterranean Animism (notable appearances include Satori and the final death fairies of the game). And truth be told, using this pattern on its own will result in you being docked points for originality.

But it's important to note that this pattern is still immensely useful. For example, Ringo's nonspells use BoWaP, and people immediately recognized that the same pattern was used in Futo's nonspells. This is an excellent case of BoWaP being used in a fashion where it was not immediately noticeable but where one of the characteristics of the pattern, in this case the clumping and spread of bullets, was used in a fashion where it was both interesting from a gameplay perspective and surprisingly creative.

Rule of thumb: Avoid using BoWaP on its own - blend it into something more complex.

That's all for this tutorial. Experiment and see what you can do!

N/A