make object move towards player p5js

Solutions on MaxInterview for make object move towards player p5js by the best coders in the world

showing results for - "make object move towards player p5js"
Neyla
26 Jan 2018
1this.rotation = atan2(player.y - this.y, player.x - this.y);
2this.speed = 2.5;
3
4this.x += cos(this.rotation) * this.speed;
5this.y += sin(this.rotation) * this.speed;