Answer the question
In order to leave comments, you need to log in
When pressing the W button using the Robot class, the character does not move forward, what's the problem?
To get acquainted with the Robot class, I decided to make a program that would control a character from the Minecraft game, but unfortunately this code does not work in the game.
The letter is printed in a notebook, but it is not possible to make the character from the game walk(
import java.awt.*;
import java.awt.event.KeyEvent;
public class Main {
public static void main(String[] args) {
try {
Robot robot = new Robot();
robot.keyPress(KeyEvent.VK_W);
robot.delay(1000);
robot.keyRelease(KeyEvent.VK_W);
} catch (AWTException e) {
e.printStackTrace();
}
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question