The last 'missing peice' in my project is AI, as in 'CPU' Players in a Simple Mortal-Combat type game.
Can anyone help me?
SPH
P.S. AIM: aGaBoOgAmOnGeR
Email/MSN: [email protected]
The last 'missing peice' in my project is AI, as in 'CPU' Players in a Simple Mortal-Combat type game.
Can anyone help me?
SPH
P.S. AIM: aGaBoOgAmOnGeR
Email/MSN: [email protected]
What you need to do is declare a variable that represents your "CPU" fighter's possible states; ie: punch, kick, block, seek, flee, stand-still - and assign a number (percentage) that represents each of these. Then at each iteration where you check your actions you would generate a random number and check it against the action's number.
Here's some psuedo code to show you what I mean:
**start code**
Stand = 15;
Seek = 25;
Flee = 35;
Punch = 50;
Kick = 70;
Block = 99;
RanNumbr = generate random number here
if (RanNumbr <= 15)
Stand
else if (RanNumbr <=25)
Seek
else if (RanNumbr <= 35)
Flee
else if (RanNumbr <= 50)
Punch
else if (RanNumbr <= 70)
Kick
else if (RanNumbr > 70)
Block
end
**end code**
Of course this is generalizing it a bit, but you should get the idea. Hope this helps.
Could you also set up some classes and objects and have the CPU check against the Users moves. Something like...
if(!player(duck))
{
cpu(lowKick);
}
else if ... ect
You already have the collision done?
Last edited by Invincible; 02-15-2002 at 09:41 PM.
"The mind, like a parachute, only functions when open."