I would like to ask how do you code for the boss behavior. Is it random or it depends on the player position? Cus I feel like the final boss has some combo behavior that is well designed.
Good question with a kind-of long answer:
The boss's attack patterns (groups of attacks) are all hard-coded, and always occur in the same order, so for example, the final boss phase 2 goes:
- (4 ground slams + 1 shockwave) x repeat this 3 times
- (Dash to the opposite side of the player, punch + shockwave) x repeat this 3 times
- Dash to 4 preset locations and shoot 2 projectiles
Then it repeats.
The individual attacks themselves depend on the player's position. For example, the boss's punch + shockwave attack will always be on the opposite side of the player (so if the boss is on your right, he will always dash to your left to punch and vice versa).
Similarly, for the ground slams, the boss picks your locations as the 'center' of the slams, and then spaces 3 or 4 (depending on phase 1 or 2) slams around you, clamping to the edges of the arena. Hope that helps! Let me know if you have any other questions, I'm always happy to talk about boss design.
love your approach! This is much better than my approach on boss fights.
I use the distance between player and boss to decide whether it is close range or long range. Then set up some parameters for close range attack A and close range attack B and randomly pick an close range attack state (A or B). I thought it might be more responsive to the player's action and the pattern will be different in every fight. But the issue with this approach is that sometimes the boss might repeat the same attack again and again,
I will combine your (groups of attacks) pattern with my close range long range approach. I believe my future boss fight game will be more challenging and fun.
My favorite combo is the punch + shockwave ! So well decided that knowing the player will roll to the boss's back and attack. And then the boss attack from above. Also appreciate your hard work with coding all the boss's attack pattern. Cant wait for your next game.
The dust effects on explosions/slashes etc are particle effects (just circles that have a changing radius and velocity). Glad you liked the effects!
For the boss: After each attack pattern bosses have a "post attack" time where they wait for roughly 1-1.5 seconds before doing the next attack, but they don't have any explicit "idle" phase (the wait time is baked into the end of each attack).