Forum Topic: Help: Enemy Random Attack

(243 views • 5 replies)

This topic is 1 page long.

<< < > >>
None

NGVisitor

Reply To Post Reply & Quote

Posted at: 3/13/07 03:47 PM

NGVisitor LIGHT LEVEL 06

Sign-Up: 11/22/05

Posts: 35

I know how to make RPG Battles but how do I make the enemy od more than one type of attack?


None

GustTheASGuy

Reply To Post Reply & Quote

Posted at: 3/13/07 03:52 PM

GustTheASGuy LIGHT LEVEL 08

Sign-Up: 11/02/05

Posts: 11,395

attack[random (attack.length)] ();

#ngprogramming at irc.freenode.net
haXe | Keel imperative | Spyro! | Thru you


None

Rathanos

Reply To Post Reply & Quote

Posted at: 3/13/07 04:44 PM

Rathanos LIGHT LEVEL 22

Sign-Up: 05/31/03

Posts: 2,105

onClipEvent(load) {
function randRange(min:Number, max:Number):Number {
var randomNum:Number = Math.floor(Math.random() * (max - min + 1)) + min;
return randomNum;
} //Code from Actionscript help file
attack=0;
}
onClipEvent(enterFrame) {
attack=randRange(1, 3);
switch(attack) {
case 1:
_root.enemy.gotoAndStop(physical_attack);
physicalAttackFunction();
break;
case 2:
_root.enemy.gotoAndStop(magic_attack);
magicAttackFunction();
break;
case 3:
_root.enemy.gotoAndStop(defense);
defenseFunction();
break;
}
}


None

trig1

Reply To Post Reply & Quote

Posted at: 3/13/07 05:16 PM

trig1 NEUTRAL LEVEL 15

Sign-Up: 10/04/05

Posts: 2,108

At 3/13/07 03:47 PM, NGVisitor wrote: I know how to make RPG Battles but how do I make the enemy od more than one type of attack?

I'm guessing by that statement you copied and pasted a code for a RPG, and then dont understand how to make it better?? That never happens...

BBS Signature

None

NGVisitor

Reply To Post Reply & Quote

Posted at: 3/13/07 05:30 PM

NGVisitor LIGHT LEVEL 06

Sign-Up: 11/22/05

Posts: 35

Thanks!


None

NGVisitor

Reply To Post Reply & Quote

Posted at: 3/13/07 08:52 PM

NGVisitor LIGHT LEVEL 06

Sign-Up: 11/22/05

Posts: 35

At 3/13/07 05:16 PM, trig1 wrote:
At 3/13/07 03:47 PM, NGVisitor wrote: I know how to make RPG Battles but how do I make the enemy od more than one type of attack?
I'm guessing by that statement you copied and pasted a code for a RPG, and then dont understand how to make it better?? That never happens...

I know how to make it better. I just don't know the AS for random enemy attacks.


All times are Eastern Standard Time (GMT -5) | Current Time: 03:51 PM

<< Back

This topic is 1 page long.

<< < > >>
You need a Grounds Gold Account to post on the NG BBS! If you don't have one, click here to sign up now! It's fast, free, and easy — and opens up tons of great NG features!