Say I wanted a boss to dig underground, effectively disappearing from the stage. Seconds later, four piles of gravel appear, one containing the boss. If the player attacks that pile, the boss takes damage, pops up, and all other piles disappear. If the boss’ pile isn’t touched, the other piles explode into bullets, two shooting either way horizontally, one shooting up, and two at 45 degree angles. After this part of the attack, the boss charges up, then creates an explosion that you have to get away from.
Look into using instance variables. You can give the boss a 'state' variable to control what it's doing.
boss.status = "digging" > trigger dig pattern
wait 2 seconds
boss.status = "underground" > trigger gravel pattern
gravel pattern > create 4 gravel at x,y > choose gravel UID 0-3 and assign one to be the boss, at this point also assign gravel.angle for shooting later
player attacks gravel where boss=true > boss take damage, destroy gravel
player attacks gravel where boss =false > destroy gravel > spawn bullet at gravel.angle assigned earlier (i.e. 0 shoots to the right, 180 to the left)
boss.status = "charging" > trigger charge attack pattern > spawn explosion
Another example, the boss jumps around with his sword out in front of him. After five jumps, he hops to a high up part of the stage unreachable by the player and begins to throw bullets down at the player.
Add a counter variable, every time the boss jumps add 1 to it, when it reaches 5, run the pattern for jumping to the higher stage and spawn bullets