- Code: Select all
//Have the monster not receive events when out of vision.
//Monster -> Draw Actor
y += 5;
if(xscreen > player.xscreen + 50)go = 0;
if(xscreen < player.xscreen - 50)go = 1;
if(go == 1)
{
x += 5;
if(AnimFinish == 1)ChangeAnimatio("EventActor", "GoRight",FORWARD);
}
if(go == 0)
{
x -= 5;
if(AnimFinish == 1)ChangeAnimation("EventActor", "GoLeft",FORWARD);
}
if(distance(xscreen, yscreen, Player.xscreen, Player.yscreen) < 50)
{
if(AnimFinish == 1 && xscreen > Player.xscreen)
{
ChangeAnimation("Event Actor", "HitLeft", FORWARD);
AnimFinish = 1;
Whack = 1;
}
if(AnimFinish == 1 && xscreen < Player.xscreen)
{
ChangeAnimation("Event Actor", "HitRight", FORWARD);
AnimFinish = 0;
Whack = 1;
}
if(distance(xscreen, yscreen, Player.xscreen, Player.yscreen) > 250)//orwhateveryouwant
{
CreateActor("Bullet", "BulletAnimation", "(none)", "(none)", 0, 0, false);
}
//Monster -> animation finish
AnimFinish = 1;
CreateTimer("Event Actor", "12", 12);
//Monster -> Key upLeftOrRight)
AnimFinish = 1;
//Have the monster have a physical response when it collides with the ground.
//Monster -> collision on any side of player
if(Whack == 1)
{
SendActivationEvent("Player");
}
//Player -> Activation event from any actor
//(this is where you do all your damage calculations)
//Bullet -> create actor
angle = direction(xscreen, yscreen, Player.xscreen, Player.yscreen);
directional_velocity = 15;
PlaySound2("data/GunShot", 1.000000, 1, 0.000000);
//Monster -> Timer(12)
whack = 0;
//Player -> collision on any side of bullet
(more damage calculation)
This Should cover most of the script.
if you want more AI stuff for difent events just let me know.
if any of you want I can post somwe AI from CommandoMan.
http://game-editor.com/forum/tp-3034--D ... 1-354.html
or from Knight Archer
http://game-editor.com/forum/viewtopic. ... 6175#16175

I hope it helps!