Space Battle...Ai For One Player

Non-platform specific questions.

Space Battle...Ai For One Player

Postby D.caaz » Mon Mar 03, 2008 3:45 am

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
Current project
Space Battle(Back on track :) )
User avatar
D.caaz
 
Posts: 109
Joined: Tue Feb 19, 2008 6:42 am
Score: 4 Give a positive score

Re: Space Battle...Ai For One Player

Postby D.caaz » Mon Mar 03, 2008 5:14 am

heres a screenshot
Image
Current project
Space Battle(Back on track :) )
User avatar
D.caaz
 
Posts: 109
Joined: Tue Feb 19, 2008 6:42 am
Score: 4 Give a positive score

Re: Space Battle...Ai For One Player

Postby edh » Mon Mar 03, 2008 11:18 am

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.
User avatar
edh
 
Posts: 233
Joined: Thu Sep 13, 2007 12:17 am
Location: Maine, USA
Score: 14 Give a positive score

Re: Space Battle...Ai For One Player

Postby D.caaz » Mon Mar 03, 2008 11:22 am

ok thanks i forgot about doing that 1+ point
Current project
Space Battle(Back on track :) )
User avatar
D.caaz
 
Posts: 109
Joined: Tue Feb 19, 2008 6:42 am
Score: 4 Give a positive score

Re: Space Battle...Ai For One Player

Postby Game A Gogo » Mon Mar 03, 2008 8:06 pm

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
Programming games is an art,
    Respect it.
User avatar
Game A Gogo
 
Posts: 3466
Joined: Wed Jun 29, 2005 10:49 pm
Location: French Canada *laughs*
Score: 181 Give a positive score

Re: Space Battle...Ai For One Player

Postby D.caaz » Mon Mar 03, 2008 10:34 pm

thanks ill try this once i add everything in
Current project
Space Battle(Back on track :) )
User avatar
D.caaz
 
Posts: 109
Joined: Tue Feb 19, 2008 6:42 am
Score: 4 Give a positive score

Re: Space Battle...Ai For One Player

Postby Game A Gogo » Mon Mar 03, 2008 11:21 pm

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
Programming games is an art,
    Respect it.
User avatar
Game A Gogo
 
Posts: 3466
Joined: Wed Jun 29, 2005 10:49 pm
Location: French Canada *laughs*
Score: 181 Give a positive score

Re: Space Battle...Ai For One Player

Postby D.caaz » Tue Mar 04, 2008 12:04 am

ooo that sounds cool! 1+Point to go with your other 77
Current project
Space Battle(Back on track :) )
User avatar
D.caaz
 
Posts: 109
Joined: Tue Feb 19, 2008 6:42 am
Score: 4 Give a positive score

Re: Space Battle...Ai For One Player

Postby Game A Gogo » Tue Mar 04, 2008 1:29 am

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 :/
Programming games is an art,
    Respect it.
User avatar
Game A Gogo
 
Posts: 3466
Joined: Wed Jun 29, 2005 10:49 pm
Location: French Canada *laughs*
Score: 181 Give a positive score

Re: Space Battle...Ai For One Player

Postby D.caaz » Tue Mar 04, 2008 1:36 am

you make good games though and some people give points for that
Current project
Space Battle(Back on track :) )
User avatar
D.caaz
 
Posts: 109
Joined: Tue Feb 19, 2008 6:42 am
Score: 4 Give a positive score


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest

cron