June 29, 20178 yr There's a keyboard section in the API. getKeyboard().pressKey(int keyCode) When you want to release the key do: getKeyboard().releaseKey(int keyCode) Edited June 29, 20178 yr by d0zza
June 29, 20178 yr Where do you grab the key-code values? I'm used to using javaFX for my applications, javaFX has an enum type KeyCode. Type methods are easy because they parameterize char/String variables.
June 29, 20178 yr java.awt.event.KeyEvent contains the key codes, such as KeyEvent.VK_SPACE would be space. https://docs.oracle.com/javase/7/docs/api/java/awt/event/KeyEvent.html
June 29, 20178 yr Author 8 hours ago, d0zza said: There's a keyboard section in the API. getKeyboard().pressKey(int keyCode) When you want to release the key do: getKeyboard().releaseKey(int keyCode) press key only presses the key once instead of holding it down when I did some tests.. is there some other way?
June 30, 20178 yr 8 hours ago, MattGP said: press key only presses the key once instead of holding it down when I did some tests.. is there some other way? Hmm I'm not sure then, but why are you trying to simulate the space key being held down? If it's for when you're talking to npcs look into the dialogue section of the API
June 30, 20178 yr Author 28 minutes ago, d0zza said: Hmm I'm not sure then, but why are you trying to simulate the space key being held down? If it's for when you're talking to npcs look into the dialogue section of the API Well for 1) tutorial island is always in dialogue so I thought it might be best to make my own complete dialogue and 2) a normal player would simply hold down space bar to go through dialogue!
Create an account or sign in to comment