Page 1 of 1

Enemy Control

PostPosted: Fri Oct 12, 2007 8:32 pm
by Azou
Hello! I don't have lot of time it's why my current game is stopped. But i have a question:how to make an actor walk,punch,jump...without any key....like a CPU? And how to make him not very...stupid? :D :D

Re: Enemy Control

PostPosted: Wed Oct 24, 2007 4:10 pm
by Azou
So ihave seen the Mortal kombat topic,i tried butt nothing is good. We always show me a error message.How ca n i fix the problem? :D :P

Re: Enemy Control

PostPosted: Thu Oct 25, 2007 12:29 pm
by Bee-Ant
maybe you could do this : (you have to create "right" , "canjump" and "EnemyAttack" Actor variables first)

Enemy>CreateActor>ScriptEditor>
1. make a random timer (1000 to 5000 ms) called "EnPunch"
2. make a random timer (1000 to 5000 ms) called "EnKick"
3. make a random timer (1000 to 5000 ms) called "EnJump"
4. make a random timer (1000 to 5000 ms) called "EnRight"
5. make a random timer (1000 to 5000 ms) called "EnLeft"

Enemy>Timer>EnPunch>ScriptEditor>
Code: Select all
if(EnemyAttack==0)
{
    if(right==1)
    {
         ChangeAnimation("EventActor", "EnemyPunchRight", FORWARD);
    }
    else
    {
          ChangeAnimation("EventActor", "EnemyPunchLeft", FORWARD);
    }
    EnemyAttack=1;
}

Enemy>Timer>EnKick>ScriptEditor>
Code: Select all
if(EnemyAttack==0)
{
    if(right==1)
    {
         ChangeAnimation("EventActor", "EnemyKickRight", FORWARD);
    }
    else
    {
          ChangeAnimation("EventActor", "EnemyKickLeft", FORWARD);
    }
    EnemyAttack=1;
}

Enemy>Timer>EnJump>ScriptEditor>
Code: Select all
if(canjump==1)
{
    yvelocity-=10;
    canjump=0;
}

Enemy>Timer>EnRight>ScriptEditor>
Code: Select all
right=1;
ChangeAnimation("EventActor", "EnemyWalkRight", FORWARD);

Enemy>TImer>EnLeft>ScriptEditor>
Code: Select all
right=0;
ChangeAnimation("EventActor", "EnemyWalkLeft", FORWARD);

Enemy>AnimationFinish>EnemyPunchRight>ScriptEditor>
Code: Select all
ChangeAnimation("EventActor", "EnemyStandRight", FORWARD);

Enemy>AnimationFinish>EnemyPunchLeft>ScriptEditor>
Code: Select all
ChangeAnimation("EventActor", "EnemyStandLeft", FORWARD);

Enemy>AnimationFinish>EnemyKickRight>ScriptEditor>
Code: Select all
ChangeAnimation("EventActor", "EnemyStandRight", FORWARD);

Enemy>AnimationFinish>EnemyKickLeft>ScriptEditor>
Code: Select all
ChangeAnimation("EventActor", "EnemyStandLeft", FORWARD);

Enemy>AnimationFinish>AllAnimation>ScriptEditor>
Code: Select all
EnemyAttack=0;

Enemy>DrawActor>ScriptEditor>
Code: Select all
if(right==1)
{
    if(EnemyAttack==0)
    {
        x+=3;
    }
}
else
{
    if(EnemyAttack==0)
    {
        x-=3;
    }
}


Fiuh...too long. If you still confused or this code can't works fine, I'll make a demo... :roll:

Re: Enemy Control

PostPosted: Thu Oct 25, 2007 7:46 pm
by Azou
you help me very very much!!! thanks loy!!!!!!