Tag Info

New answers tagged

3

XNA only supports one keyboard. It supports up to four chatpads, which look exactly like keyboards in terms of the state they track (note the subtle differences in the overloads of Keyboard.GetState). Anyhow, KeyboardState object just reflects the state of a keyboard or chatpad. On its own, it doesn't know or care about whether or not it's representing the ...


1

I don't know java, but it seems to me that the Command pattern would help you. It is a behavirol pattern by the Gang of Four wich encapsulates your information to be executed, in your case this information is user input. I'm copying/pasting wikipedia here import java.util.List; import java.util.ArrayList; /* The Command interface */ public interface ...


4

in your keyPressed and keyReleased you can use a Map to map the KeyEvent.VK_* to GameInput make a new enum with the actions you want to be controllable enum GameInput{ FORWARD, LEFT, RIGHT, BACK,PAUZE,... } and in Controller you have a Map that you use: public void keyPressed(KeyEvent e) { game.setKeyDown(keyMap.get(e.getKeyCode())); } public void ...



Top 50 recent answers are included