We are about to switch to a new forum software. Until then we have removed the registration on this forum.
PVector location = new PVector();
PVector velocity = new PVector();
void setup() {
size(1024, 576);
}
void draw() {
background(0);
PVector mouse = new PVector(mouseX, mouseY);
mouse.sub(location);
velocity.x = mouse.x / (mouse.x + mouse.y);
velocity.y = mouse.y / (mouse.x + mouse.y);
location.add(velocity);
fill(255);
ellipse(location.x, location.y, 40, 40);
}
Answers
https://forum.Processing.org/two/discussion/15473/readme-how-to-format-code-and-text
Sorry for my code. It's wrong anyways. To get my speed to always be constant, do i have to use the rotate function?
Read The Nature of Code from Daniel Shiffman. It will help a lot.
following what @Lord_of_the_Galaxy answered; you should search Daniel Shiffman's tutorials and book, if you are interested. As a direct answer I made the following code, referring to this shiffman.youtube video, it creates a new force PVector acceleration and uses that as variables for movement instead:
full version, hope it helps: