AI code. A basic code for a shooting game...

Game Editor comments and discussion.

AI code. A basic code for a shooting game...

Postby Sgt. Sparky » Thu Feb 15, 2007 12:52 am

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
:D
I hope it helps!
Image
Random Links:
viewtopic.php?p=19474#19474
Right now (10/14/2009) I'm working on some C++ projects, but I might be able to help if you have some Game Editor questions. :)
User avatar
Sgt. Sparky
 
Posts: 1850
Joined: Sat Oct 07, 2006 5:28 pm
Location: Somewhere out there, beneath the pale blue sky...
Score: 236 Give a positive score

Woah. Nice.

Postby Hblade » Tue Apr 03, 2007 12:00 am

Woah. Nice. I like this code allot.
Subscribe to my YouTube? - Yes| No
User avatar
Hblade
 
Posts: 4455
Joined: Fri Dec 08, 2006 11:14 pm
Score: 181 Give a positive score

Postby UltimatHedgehog » Tue Apr 03, 2007 2:05 am

Hblade!! You've returned from beyond the grave! :D YAY!!

p.s. if youre confused read what i said on lets all team up
Image
I always thought Hell would be a giant load screen that goes on for eternity, then one day, eons later, it would end, only to reveal a slightly different loading screen.
User avatar
UltimatHedgehog
 
Posts: 325
Joined: Fri Jan 19, 2007 1:48 pm
Location: http://downloads.khinsider.com/?u=112542 plz click
Score: 10 Give a positive score

Postby Sgt. Sparky » Tue Apr 03, 2007 2:57 am

erm... what are we teaming up on?... :|
I know we are teaming up... just on what :?: :|
Image
Random Links:
viewtopic.php?p=19474#19474
Right now (10/14/2009) I'm working on some C++ projects, but I might be able to help if you have some Game Editor questions. :)
User avatar
Sgt. Sparky
 
Posts: 1850
Joined: Sat Oct 07, 2006 5:28 pm
Location: Somewhere out there, beneath the pale blue sky...
Score: 236 Give a positive score

Some time.

Postby Hblade » Wed Apr 04, 2007 8:46 pm

Some time. After I finish My Game, Hblade, Ten, We might team up, But intill ten, what with everything going on, I will just work on my game Hblade.
Subscribe to my YouTube? - Yes| No
User avatar
Hblade
 
Posts: 4455
Joined: Fri Dec 08, 2006 11:14 pm
Score: 181 Give a positive score


Return to GE - General

Who is online

Users browsing this forum: No registered users and 1 guest

cron