Hello I am wondering how I would make an object
move towards another object
or point
. Down here is a tick method which is set to update 60 times a second. It's just a basic thing which moves based on the change in x
and y
.
All help is appreciated, thanks.
public void tick() {
x += dX;
y += dY;
if(y <= 16 || y >= Game.HEIGHT-62) velY *= -1;
if(x <= 16 || x >= Game.WIDTH-39) velX *= -1;
collision();
}