"Move towards" script not working

Fill this out this info to make it easier for the community to help you! If you don’t fill out this information, your post may be deleted or removed.

What Wick Editor Version are you using?
1.19.3
Describe the Problem
What issues are you having in the Wick Editor?
I’m trying to make a script so that a zombie character moves towards the player, but whenever the player moves, the zombie stops moving/moves backwards.
What have you tried so far?
I tried adding multiples of 90 to the rotations to try to fix this.

Do you have a Wick Editor File that we can see? Optional*
ZombieFighter4-1-2022_8-23-57.wick (3.0 KB)

i’m a phone right now can you send the code related to moving the zombie towards the player?

i’m not sure how the player moving would make zombies glitch out in that way, if you’re doing it correctly. there are 2 ways to make an object move towards another at a certain speed.

  1. angles
var angle = Math.atan2(target.x - this.x, target.y - this.y);
this.x += Math.cos(angle) * speed;
this.y += Math.sin(angle) * speed;
  1. vectors
var dx = target.x - this.x;
var dy = target.y - this.y;
var dist = Math.sqrt(dx * dx + dy * dy);
this.x += dx / dist * speed;
this.y += dy / dist * speed;

Thank you!