(What I am asking is at the bottom, these are the assets I am expecting you will need.) I am currently working on a .io game project. Here is my code for the player:
function Snipe(img, x, y) {
this.pos = createVector(x, y);
this.img = img;
this.vel = createVector(0,0);
this.angle = 0;
this.name = "I";
this.score = 0;
this.update = function() {
var newvel = createVector(mouseX-width/2, mouseY-height/2);
newvel.setMag(3);
this.vel.lerp(newvel, 0.2);
this.pos.add(this.vel);
}
this.show = function() {
image(this.img, this.pos.x - 75, this.pos.y - 15);
fill(255);
textSize(20);
textAlign(CENTER);
text(this.name, snipe.pos.x, snipe.pos.y + 135);
}
}
The player looks like this (I recommend putting a black background over it):
So, let’s get to the point. I am trying to make the player turn torwards the mouse. Not adding the ability to move torwards the mouse, I already got that, only just need to add the ability to rotate torwards the mouse. If you need more clarification, or more of my code (that was one, and I have 2), ask me. I was looking for this all over Google for one day, and no working results. Make sure it is pointing the mouse at the pointed end, rather than the rounded end. (You don’t have to, just try if it is possible.) Can you tell me how that is possible? Thanks!