Thanks 3run (maybe you saved my day)!!
yeah, your code works good, but is it possible to make the player moving to the magnet-entity and not the magnet-Entity to the player??
I was given the Magnet-Entity the scan part, and the player got the event "got_scanned()".
I have problems with this part:
if (vec_dist (player.x, my.x) > 50) // the object isn't close enough to the magnet?
{
vec_set(temp_pos, player.x);
vec_sub(temp_pos, my.x);
vec_to_angle(my.pan, temp_pos);
my.tilt = 0;
// the entity is oriented towards the magnet here
c_move (my, vector(3 * time_step, 0, 0), nullvector, GLIDE);
}
I know that i have to replace "player.x", but what can i use? i think "you.x" will create a crash. Maybe a pointer for the magnet-Entity?? But then i can only use one magnet in a level, can`t I ?