Page 1 of 1

RPG Attacks!

PostPosted: Tue Apr 22, 2008 1:51 pm
by CrimsonTheDarkBat
For my new Sonic RPG, I need to find a way to randomise an enemys attacks. Please help!

Re: RPG Attacks!

PostPosted: Tue Apr 22, 2008 2:08 pm
by Bee-Ant
Use random timers, or random variables...
Btw, I cant help before know what about your game structure first

Re: RPG Attacks!

PostPosted: Tue Apr 22, 2008 2:18 pm
by Bee-Ant
For random variable, put this code on DrawActor of enemy
Code: Select all
attackstyle=rand(3);

Then use timer to attack...
Code: Select all
if(attackstyle==0)
{
//attack 1
}
if(attackstyle==1)
{
//attack 2
}
and so on...

Re: RPG Attacks!

PostPosted: Tue Apr 22, 2008 3:47 pm
by DST
The method is good, just use a switch instead of if. Saves CPU.
Code: Select all
switch (attackstyle)
 {
case 0:
//attack 0
break;
case 1:
//attack 1
break;
case 2:
//attack 2
break;
}