Page 1 of 1

Fighting Game Enemy

PostPosted: Sun May 03, 2009 7:25 pm
by GuybrushThreepwood
I'm making a two person fighting game. Two people fight at the same time, and I want to know how to make the computer try to attack the player

Re: Fighting Game Enemy

PostPosted: Sun May 03, 2009 7:47 pm
by skydereign
Personally, I would create functions for each attack you want the enemy to do. That way, upon the time of attack, a controlled random event, it will make the enemy attack, and it can't do anything else. When the attack ends, it may continue about its AI life. The function would set the enemy's animation, set a variable to signify attack, and other. This really depends on how you are doing damage, general attacking, and more. I could help you out, but can you post a demo of your game? Or perhaps you could just explain it. But here is a sample of what I am talking about.
Code: Select all
void
AI_Sword(void)
{
     //The change animation code here
     Enemy_Attack=1;  // this would be an int, if it equals one, it can't do anything
     //Other code depending on what system you are using
|

If you don't like this method, I can show you several more.

Re: Fighting Game Enemy

PostPosted: Mon May 04, 2009 12:37 am
by GuybrushThreepwood
it's not that kind of fighting game, its like mortal combat type style. :mrgreen:

Re: Fighting Game Enemy

PostPosted: Mon May 04, 2009 1:39 am
by jimmynewguy

Re: Fighting Game Enemy

PostPosted: Mon May 04, 2009 6:29 am
by GuybrushThreepwood
well these are good, but in my game there are combo attacks. how would i do that?

Re: Fighting Game Enemy

PostPosted: Mon May 04, 2009 6:39 am
by skydereign
I vaguely remember helping you with the combos. I would really do these by function calls, that way the actual code would be less convoluted. But if you don't want to set that up, then what you would need to do is add an animation finish event. If you want it to always combo, then upon the animation finish, you trigger the next attack, if not, then you would set a rand in, and if it is the right number, continue the combo.

Re: Fighting Game Enemy

PostPosted: Mon May 25, 2009 3:15 pm
by Bee-Ant
GuybrushThreepwood wrote:well these are good, but in my game there are combo attacks. how would i do that?

Use Keydown->Press the keys->and change the "at least one key pressed" to "..."
Keys as order or something
Sorry I forget :oops:
Just see it yourself