A little more AI :)

Game Editor comments and discussion.

A little more AI :)

Postby Oman » Tue Jun 12, 2007 1:08 am

Ok guyes... don't worry, i no how to make the enemy move to my player,

My problem is that if my enemy is above the player when he starts, he will seem to float.

I put this code in draw actor of enemy...

if(distance(x, y, player.x, player.y) < 160)
{
angle = direction(x, y, player.x, player.y);
directional_velocity = 2;
}

Sooo, now he goes to my player... but since (in my game) the enemy starts above the player, the enemy seems to float down to the player.

I want the enemy to walk only on the x axis, but not the y.

Any help is appreciated :)

Oman

p.s. if u havent already guessed, my game is a platformer. :)
"Beyond a wholesome discipline, be gentle with yourself." - Max Ehrmann
User avatar
Oman
 
Posts: 268
Joined: Tue Oct 31, 2006 4:00 am
Location: Somewhere out there...
Score: 6 Give a positive score

Postby Game A Gogo » Tue Jun 12, 2007 1:16 am

Code: Select all
if(distance(x, 0, player.x, 0) < 160)
{
angle = direction(x, 0, player.x, 0);
directional_velocity = 2;
}
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

Postby Oman » Tue Jun 12, 2007 1:27 am

I knew it was something like that.

Thanks a lot Gogo. :D
"Beyond a wholesome discipline, be gentle with yourself." - Max Ehrmann
User avatar
Oman
 
Posts: 268
Joined: Tue Oct 31, 2006 4:00 am
Location: Somewhere out there...
Score: 6 Give a positive score

Postby Game A Gogo » Tue Jun 12, 2007 11:14 pm

anytime!
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


Return to GE - General

Who is online

Users browsing this forum: No registered users and 1 guest

cron