Hello everybody!

Today I'd like to post a little article that might help people with their game's boss enemies. It's nothing amazing but it's something I've just figured out myself and figured others might find it useful so here we go!

--

THE BAD WAY OF BOSSES FOR THE COMPLETE & UTTER N00B
Or, What I used to do

I won't shit anyone here- I've not been all that great at making boss enemies in the past. I'm happy to report I'm getting better, but I used to make a lot of n00b mistakes. One of the biggest ones was that I'd have a boss's "taking damage animation", and when it'd get hit it'd change to that animation and go back to normal afterwards.

Now let's say you make it so that the boss's "damaged" animation is invunerable to player attacks. Makes sense to me. Now let's also say it returns to it's stopped animation after the damaged one is finished. But what if the boss was in the middle of an attack when the player hit it? If you automatically make it go to being damaged, you'll interrupt its attack and it'll return to a stopped state. Well that's no good because your player could go on and fight unscathed the whole time, beating the snot out of your suddenly toothless enemy.

One way to possibly fix this would be to just make the boss invincible during its attack animations too. If you have a boss with a lot of attack animations this could quickly pile up into a near undamagable boss! And that sucks. Your other option might be to assign it a variable to keep track of what animation it was in the middle of and return back to it after the damage animation has played. This has all sorts of potential to be jumpy and crappy-looking. What can we do??



THE GOOD WAY
Two bosses at all times

I thought of a great way to make it so that you can have your enemy boss take damage while any of its animations are playing, show it take said damage, and return exactly where the animation and frame left off. To do it you'll need a couple of things:

1) A complete boss sprite with all its animations (stopped, walking, attack 1, attack 2, etc.)

2) An exact clone of this boss that will get a recolor to every animation. A quick way to do this is to use MMF's color replacer at the start of whatever frame the boss fight is on. When you're done make this clone invisible. Make an alt variable for this clone called "FLASHTIME" and set it to 0.

3) When the player hits the boss with his weapon, set its 0 flag to ON and FLASHTIME to 10 (for example). Important: Make sure that one of the conditions for the player to hit the boss in the first place is that the boss flag 0 is OFF.

4) Have an event check to see if boss flag 0 is ON, and if it is subtract 1 from FLASHTIME every X milliseconds (or whatever, it's up to you). Have another event check to see if FLASHTIME is <= 0 and if it is return boss flag 0 back to OFF.

5) Near the bottom of the events always set your clone's animation and frame to that of your real boss's animation and frame.

6) At the very bottom have 2 checks on the state of boss flag 0. If it's OFF make the clone invisible and show the real one. If it's ON make the boss invisible and show the clone.

--

The method is simple enough. You're always checking the boss's 0 flag. If it's set to OFF, the clone is invisible and the real boss is shown. If it's set to ON the clone is visible and the real boss is not. You can also have both clone and boss's maximum movement speed set to 0 while it's in a state of injury so it looks like it's temporarily stunned. Now when you hit your boss with a weapon you'll stun it, change it's color to show the player you've hit / damaged it (because the recolorized clone is now visible and in perfect synch with the original), and after that brief flash time it will continue along it's current animation without weird animation jumping or you having to resort to making some animations exempt from getting hurt.

Oh man, I hope I said all of this right . If there's anything to clear up later I'll edit this then. Just trust me it works.