Page 1 of 1

A little more AI :)

PostPosted: Tue Jun 12, 2007 1:08 am
by Oman
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. :)

PostPosted: Tue Jun 12, 2007 1:16 am
by Game A Gogo
Code: Select all
if(distance(x, 0, player.x, 0) < 160)
{
angle = direction(x, 0, player.x, 0);
directional_velocity = 2;
}

PostPosted: Tue Jun 12, 2007 1:27 am
by Oman
I knew it was something like that.

Thanks a lot Gogo. :D

PostPosted: Tue Jun 12, 2007 11:14 pm
by Game A Gogo
anytime!