The Daily Click ::. Forums ::. Klik Coding Help ::. How to program mega man bosses?
 

Post Reply  Post Oekaki 
 

Posted By Message

tetsuya_shino



Registered
  12/08/2004
Points
  491
4th October, 2012 at 04/10/2012 06:13:14 -

Greetings. I'd like to hear everyone's opinion on how to program a mega man style boss in tgf. Here is a youtube video showing many boss fights. Of course I don't want my bosses to be able to be defeated this easy;

http://www.youtube.com/watch?v=FzaD2JJCB3k

Basicly I'd like to do the same thing;

* Have the player character face of against a single enemy with a health bar.
* The area would be a non scrolling enclosed area.
* Boss should have many different attack animations.
* Boss should have many different attack patterns or one complex pattern.
* When hit, the boss should randomly play a stunned animation. Otherwise, getting hit doesn't cancel boss's current anim.

That last one is the one that bothers me the most. I guess you can say I basicly already know how to go about this, but I'd like to hear what others have to say about this before giving it a try.

And while you are here, I'd like to ask a few other questions as well;

Other then the arrow keys, what do you feel is the max number of keys an action platform game should have?

Is using the number keys to swap weapons useful or annoying?

Thanks.

 
n/a

Sumo148

Super amazing fantastic user

Registered
  26/01/2009
Points
  530

360 OwnerThe Cake is a LieVIP MemberPokemon Ball!I am an April FoolI donated an open source projectSanta Hat
4th October, 2012 at 04/10/2012 19:16:06 -

Personally for platforming games I would say two extra buttons aside from the arrow keys would be nice. For the stunned animation that's actually really simple. There's an action that allows you to "flash" the current animation. It's under the visibility tab when you select a new action for an active.

 
n/a

Chloe Sagal

under the influence of FUN

Registered
  19/02/2009
Points
  607

Orange
4th October, 2012 at 04/10/2012 21:29:09 -

I'm writing this without ever once using TGF, so hopefully it will apply.

First of all, make sure you plan out your bosses attacks, etc, it will make it so much easier. The idea is to give the boss an alterable value (or string preferably for the sake of readability), and the boss runs different code depending on it's value, for instance, idle, shoot, jump, damage, etc.

Here is a quick example of a boss that waits, jumps on the player and shoots at the player.

Changing States
Boss flag 0 is off (determines that the boss is changing states)
Random State = 0
:Set state to Idle
:set counter to whatever (the amount of time to wait in idle, could be a random value)
:set flag 0 on

Boss flag 0 is off
Random State = 1
:Set state to Shoot
:set counter to whatever (the amount of times you want the boss to shoot, could be a random value)
:set flag 0 on

oss flag 0 is off
Random State = 2
:Set state to Jump
:set counter to Player X
:set flag 0 on

Idle
Boss state equals idle
counter > 0
:subtract 1 from counter

Boss state equals idle
counter = 0
:set random state to 1 + random(1) (makes the boss do something other than go back to idle)
:set flag 0 off

Shooting
shotcool > 0
:subtract 1 from shot cool

Boss state equals shoot
counter > 0
shot cool = 0
:face player (if you want the boss to shoot at the same spot, have this line when you change the state to shooting)
:shoot bullet
:set shotcool to whatever (the time between shots)

Boss state equals shoot
counter = 0
:set random state to random(2)
:set flag 0 off

Jump
This code depends on your movement engine, simply have the enemy jump on the Y axis and move on the X to the player X you put in. You might also get creative and program in a way to offset the X depending on where the player is going and at what speed. Then, obviously, like the others, when it is finished, set the random state counter to a random value (or again, get creative here if you want the boss to react more to the situation) and set the flag 0 off to let the boss know he needs to change states.

You can also program in pauses between switching states, depending on your gameplay.

And obviously, you can set a separate state for the boss taking damage, that will disable all movement codes, and perhaps taking damage code when that state is active. You can cause the boss to resume it's previous attack by setting in new values, or simply interrupt the attack and cause the boss to think.

It might be easier to test this in a separate frame, or make sure to have a temporary debug mode in your game/temporary shortcuts to make reaching the boss easier. Animations will obviously be handled here.

Do you have the camera focused on the player or a camera object? If it is a camera object, simply disable it's scrolling during the boss fight and lock it to the coordinates in the center of the boss fight area.

But yeah, that's what I'd do.

EDIT: I should also point out that the bosses in Mega Man are designed to have certain weaknesses to certain weapons, hence why they seem so easy in that video.

EDIT TWICE: Nevermind, that guy makes the game look easy. Either he's a pro or he has figured out how to manipulate time and space.

Edited by Chloe Sagal

 
Patreon: http://www.patreon.com/chloesagal
Twitter: https://twitter.com/ChloeSagal

tetsuya_shino



Registered
  12/08/2004
Points
  491
5th October, 2012 at 05/10/2012 05:22:30 -

@Sumo148 - Flashing, huh? I never heard of that before. I'll give that a try and see if it's what I'm looking for. Thanks.

@Oh hey, Chloe! - Thank you for typing that all out. What you wrote is actually very close to what I was already planning to do. So it's kinda reassuring that others use this method. So I guess I will start doing a little test coding and see how it goes. Thank you.

 
n/a

Chloe Sagal

under the influence of FUN

Registered
  19/02/2009
Points
  607

Orange
7th October, 2012 at 07/10/2012 21:56:23 -

Yw
Glad to know I'm kind of doing it right too.

 
Patreon: http://www.patreon.com/chloesagal
Twitter: https://twitter.com/ChloeSagal
   

Post Reply



 



Advertisement

Worth A Click