I want to move an entity toward a specific point without changing the pan of the entity is this possible?, I want to do this because when let's say an enemy attack the player he should move backward while playing he's hurt animation. this is what I have.

On the enemy's code I set this vector so it stays in front of the enemy, some kind marker where the player should move when he's getting hurt:

marker.x = enemy.x + 500 * cos(enemy.pan);
marker.y = enemy.y + 500 * sin(enemy.pan);

On the player's event I have this so when the touches the player he starts moving toward the marker:

vec_set(temp, marker.x);
vec_sub(temp, player.x);
vec_set(temp2, marker.y);
vec_sub(temp2, player.y);
player.x += temp*1*time_step;
player.y += temp2*1*time_step;

The problem with this is that collision won't work.

The other way I found is changing the entity's pan but I don't want to use this because it looks lame:

vec_set(temp, marker.x);
vec_sub(temp,player.x);
vec_to_angle(player.pan, temp);
c_move (player, vector(10 * time_step, 0, 0), nullvector, IGNORE_PASSABLE | GLIDE);



Last edited by Theil; 10/07/09 22:29.