New answers tagged

0

Have you considered supporting gamepad controllers? For inspiration the game Duel (https://github.com/odanek/duel6r) supports 4 positions on keyboard + others on gamepads. And for completeness - numpad keys can be used too to give you more room around the keyboard.


0

public void run() { long beforeTime, timeDiff, sleep; beforeTime = System.currentTimeMillis(); while(true){ coin2.move2(); //move the 2nd coin based on the inputHandler repaint(); timeDiff = System.currentTimeMillis() - beforeTime; sleep = DELAY - timeDiff; if(sleep < 0) sleep = 2; ...


1

Unity's InputManager isn't well suited for this task, I strongly recommend interfacing directly with the APIs that SteamVR provides for Unity games: SteamVR_Controller.Device.GetAxis is most likely going to be the easiest way to get the behavior you want: public Vector2 GetAxis(EVRButtonId buttonId = EVRButtonId.k_EButton_SteamVR_Touchpad) So to treat it ...


0

it is better to run your animation on button press something like this void Update () { if (Input.GetKey (KeyCode.Space)) //Play your animation } and then check on update that if your animation have finished then shoot bool animationClipPlaying = false; void Update() { if (GetComponent<Animation>().IsPlaying(...


0

You can do something different. You could use Unity's animation events system. You can find it in the Animation tab (the bookmark with plus sign on it). Actually you can just check this Unity manual page. In your update method (better cache your animator link in start/awake): void Update () { if (Input.GetKey (KeyCode.Space)) { ...


0

It's been a while since I used Unity, but I don't think you need the Coroutine. I'd just use a private variable instead. private const float timeToCharge = 0.3f; private float chargeTimer = 0.0f; private void Update() { if (Input.GetKey(KeyCode.Space)) { chargeTimer += Time.deltaTime; if (chargeTimer >= timeToCharge) { ...


1

As others have pointed out, you can't be sure the player has a keyboard with anti-ghosting so this simply wont be possible on most non-gaming keyboards. Regardless, I think the best solution would be to let the players decide when the game starts. Everyone positions their hands where they're comfortable then each player is prompted, one by one, to press ...


3

Just as a heads up, most keyboards have a finite limit of keys that can be pressed. For example, I have an Asus Transformer Book and you can only press around ~5 keys at a time. Some keyboards also won't allow more than a few keys pressed if shift or control is being pressed. (Like my Transformer Book...) And yes, most of the time, this is hardware limited, ...


0

Depends on the player's keyboard hardware. You cannot make a set that will work for sure on everyone's computer. Make sure your game design does not encourage the players to hold more than one key, as you'll run into the limit on the number of keys that can be reported at a time.


0

WASD and Arrow Keys are good options for two players. According to Wikipedia, IJKL is a common option, so that could be used for the third player. If the keyboard has a number pad, you can use that for the fourth player. Otherwise, GVBM is the most spaced set of letters in the WASD shape. For the fifth key for each player, you could potentially use a ...



Top 50 recent answers are included