The right code is

while (vec_dist(my.x,player.x)>8 || !key_space) ....

You want the point not to be eaten when its far from the player, OR when the space key is not pressed.