Quantcast
Channel: Latest Questions by greatUnityGamer
Viewing all articles
Browse latest Browse all 99

2 key combo problem.......

$
0
0
Hi. So i have in update a check for input release of 2 keys It's W+A at the same time so first i have check to see if those were pressed. This is all in the update() method if( Input.GetKey(Keycode.W) && Input.getKey(Keycode.A) ) change rotation of character to diagonal return; } if(Input.GetKeyUp(Keycode.W) && Input.getKeyUp(Keycode.A) ){ change rotation of character to original return; } if( Input.GetKey( Keycode.S) OR Input.getKeyUp(Keycode.S) { //move down(towards camera in other words facing you //the player) } ***** The Problem is after i do the W+A combo. seems i have to exagerate my release of the keys in order to get the result that i programed in "keyUP" otherwise it doesn't work. Is this common? i'm on a Mac. If i release lightly softly, then it seems it doesn't register that i have let the keys up. Because sometimes for example i release the 2 keys and immediately follow an S for down. And what happens is the character remains in the ROTATION i set for the W+A combo. and it does move towards the camera but it is facing stil diagonal and away from me. when the desired outcome is that at anytime when i press S(down, towards camera) the character should turn to face me. So yeah, i have noticed, in order to make it work i have to release with exageration. Is there a way to make it recognize my release of the 2 keys even if i release lightly? Here's a pic of what my game looks like. and i did the W+A combo to go diagonal forward to the left![alt text][1] [1]: /storage/temp/15467-screen+shot+2013-09-14+at+10.23.39+pm.png

Viewing all articles
Browse latest Browse all 99

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>