Make a movable object (player) turn to face where the mouse is
in
Programming Questions
•
2 years ago
Hi everyone, I am fairly new at Processing, and java, so I hope some of you can help!
I'm making a shooter game with a movable player. However I am stuck on how to make him face where the mouse is, so that I can then code him to shoot in that direction. Hopefully that's clear for you guys?
Here is what I have at the moment*:
void setup() {
size(200,200);
smooth();
}
void draw() {
background(255);
rectMode(CENTER);
fill(0);
rect(50,50,20,50);
}
Although my real code for my game has classes, arrays etc, this is what I have done to make my problem as specific as possible - so my player is just a rectangle...
Hope one of you geniuses can help! :P
1