Page 1 of 1

Space Battle...Ai For One Player

PostPosted: Mon Mar 03, 2008 3:45 am
by D.caaz
how can i would AI for Space Battle? I've tried using paths but it goes to fast i need one that goes the same speed as x=x+5

Re: Space Battle...Ai For One Player

PostPosted: Mon Mar 03, 2008 5:14 am
by D.caaz
heres a screenshot
Image

Re: Space Battle...Ai For One Player

PostPosted: Mon Mar 03, 2008 11:18 am
by edh
If the top circle is supposed to go back and forth, you could create two wire frame regions - one left, one right. When the ship collides with one, xvelocity *= -1; (change the sign, which reverses direction).

If you use a path, change the number of frames to slow it down. If you have 10 points on your path, setting frames to 120 or something will make it move more slowly along the path.

Re: Space Battle...Ai For One Player

PostPosted: Mon Mar 03, 2008 11:22 am
by D.caaz
ok thanks i forgot about doing that 1+ point

Re: Space Battle...Ai For One Player

PostPosted: Mon Mar 03, 2008 8:06 pm
by Game A Gogo
or here is a more realistic one
NOTES: BulletP is your ship's bullet~
EShip is the enemy/boss
PShip is your ship
Code: Select all
if(actorcount("BulletP")==0 || BulletP.y>y)//Check if there is no bullet on game
{
if(x+(width/2)<0-(view.width/2) && x+(width/2)>(view.width/2))//Does not make the ship go out of screen
{
    if(x<PShip.x)
    {
        x+=1;
    }
    else if(x>Pship.x)
    {
        x-=1;
    }
}
}
else if(actorcount("BulletP")>0)//Check if there a bullet created
{
if(x+(width/2)<0-(view.width/2) && x+(width/2)>(view.width/2))//Does not make the ship go out of screen
{
    if(x<BulletP.x)
    {
        x-=1;
    }
    else if(x>BulletP.x)
    {
        x+=1;
    }
}
}


hope this works good, you may need to play with the thing that makes the ship stay in screen, I don't think it's right

Re: Space Battle...Ai For One Player

PostPosted: Mon Mar 03, 2008 10:34 pm
by D.caaz
thanks ill try this once i add everything in

Re: Space Battle...Ai For One Player

PostPosted: Mon Mar 03, 2008 11:21 pm
by Game A Gogo
oh ya, I forgot to tell you what it does...

When there is a bullet that you have shoot, it will go away from it, when there is no bullets in game, it will go at the same position as you, so it can shoot back and actually aims a little

Re: Space Battle...Ai For One Player

PostPosted: Tue Mar 04, 2008 12:04 am
by D.caaz
ooo that sounds cool! 1+Point to go with your other 77

Re: Space Battle...Ai For One Player

PostPosted: Tue Mar 04, 2008 1:29 am
by Game A Gogo
lol, thank you :3
altough, personally, I don't think I have merited that much points... I mean, I really don't help a lot :/

Re: Space Battle...Ai For One Player

PostPosted: Tue Mar 04, 2008 1:36 am
by D.caaz
you make good games though and some people give points for that