RPG Attacks!

Non-platform specific questions.

RPG Attacks!

Postby CrimsonTheDarkBat » Tue Apr 22, 2008 1:51 pm

For my new Sonic RPG, I need to find a way to randomise an enemys attacks. Please help!
Sonic Velocity Development Thread --> http://game-editor.com/forum/viewtopic.php?f=4&t=11461

Completed Games:
Sonic: War of the Emeralds
Sonic: Empire of Nightmares
Sonic.EXE - The Game
Alice: Crimson Omen
Epsilon 27
User avatar
CrimsonTheDarkBat
 
Posts: 223
Joined: Fri Mar 21, 2008 10:54 am
Score: 20 Give a positive score

Re: RPG Attacks!

Postby Bee-Ant » Tue Apr 22, 2008 2:08 pm

Use random timers, or random variables...
Btw, I cant help before know what about your game structure first
User avatar
Bee-Ant
 
Posts: 3723
Joined: Wed Apr 11, 2007 12:05 pm
Location: http://www.instagram.com/bee_ant
Score: 210 Give a positive score

Re: RPG Attacks!

Postby Bee-Ant » Tue Apr 22, 2008 2:18 pm

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...
User avatar
Bee-Ant
 
Posts: 3723
Joined: Wed Apr 11, 2007 12:05 pm
Location: http://www.instagram.com/bee_ant
Score: 210 Give a positive score

Re: RPG Attacks!

Postby DST » Tue Apr 22, 2008 3:47 pm

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;
}
It's easier to be clever than it is to be kind.
http://www.lostsynapse.com
http://www.dstgames.com
User avatar
DST
 
Posts: 1117
Joined: Sun Apr 15, 2007 5:36 pm
Location: 20 minutes into the future
Score: 151 Give a positive score


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest

cron