I'm making a game, and the character is going to be permanently in the center of the world. How can I make it that the actor turns in the direction of the mouse?


public void act() { // These are declaring the X and Y variables of the mouse location as mX and mY int mX = MouseInfo.getX; int mY = MouseInfo.getY; }
MouseInfo mouse; //Going to be our MouseInfo object int mX,mY; //Going to be our variables keeping track of the mouse position public void act(){ mouse = Greenfoot.getMouseInfo(); //Gets the mouse info if(mouse!=null){ //The mouse info can sometimes be Null, so check for that mX = mouse.getX(); //If the mouse is not Null, update the position variables mY = mouse.getY(); } }