Help with ai code

so far my ai does this

http://spamtheweb.com/ul/upload/230408/6 3513_ikkakuwitharray.swf

i want to make him attack me when he is close enough to me and if he hits me

how to make it go to a second attack

but if ikkaku block= true and the monsters attack hits me he would go to the animation movie clip named attackblocked

i know id have to use an array but how do u make ai use arrays?

also this isnt as important for now but id like him to have a timer so it only attacks every so often

PLEASE PLEASE help me out on this guys anyone at all

Arrays in games are best for keeping track of multiple enemies.

I’d suggest thinking about what actions you want to happen i.e. “attack”, “defend”, “move”, “dodge”… and make functions out of those. For example an attack might be like.



public class WingEnemy extends Enemy
{
     internal function aiAttack($ikkaku:Hero):Reaction
     {
           if(!$ikkaku.block)
           {
              // where PlayerHealth is a static Singleton class
              PlayerHealth.Hurt(-10)
              
              // make attackReaction a sub-class of Reaction
              return attackReaction() 
           }

           if(ikkaku.block)
           {
              return blockReaction()
           }
     }


cuz, you talkin in a different language then me

i have no clue how to work classes

or singletons

im using coding on just one frame and it attaches the hero movie clip and the enemy movieclip

and the enemy respawns if its killed

but i cant get my enemy to do anything besides come to me and when its 70 away form me it stops… within reach of my weapon but its stil doing the flying animation

until its hit
when its hit itll go to a random animation and im fixing the code now so that if he goes to “block” he wont
lose hp

i want to have him be like a streetfighter ai

but i dont like that whole ai random thing i have

i want my monster to be a fighting monster that can block me sometimes, hit me, fall when hit by full combo and get away from me at certain hp levels and come back with an attack

until its dead

[COLOR=“Blue”]COULD YALL VIEW MY LINK AND THEN SEE WHAT COULD BE DOEN TO THAT AI TO BETTER IT[/COLOR]

[COLOR=“Red”]http://spamtheweb.com/ul/upload/230408/6 3513_ikkakuwitharray.swf[/COLOR]

thats the link sorry for double post

wrong forum.

try Game / AI programming for help?

but what i would suggest is, if you don’t understand the language ultraky is writing code in… You should probably learn a bit about flash / actionscript or basic language elements of programming.

[quote=youngtrill;2324525][COLOR=Red]http://spamtheweb.com/ul/upload/230408/6 3513_ikkakuwitharray.swf[/COLOR]

thats the link sorry for double post[/quote]

Do some more animation to zombie like falling to ground and a bit more , then i will tell you the logic