Pages

Flash Game Play Gyaan - When KEY_DOWN and KEY_UP events fail you!

I was just prototyping a game in ActionScript 3.0 using Flash Develop. I was trying to remake the Contra gameplay - you know just for the heck of it.

I had used the following keys - Arrow Keys for movement + "Z" key for Firing.

The scenario, if you remember Contra - Player can run and fire. They can also use Up and Down arrow to shoot at an angle(say 45 degrees).

The code seemed to work when I used:
-Right, Up and Z
-Right, Down and Z

But it failed when I used:
-Left, Up and Z
-Left, Down and Z

I debugged for a day but couldn't figure out anything. The "Fire" key was never registered when I had held down Left Arrow with either Up/Down.

Frustrated  - I changed the "Fire" key from "Z" to "Q" and "A" and so on.
Bah! I ran into same problem - but different combinations!

Finally, after googling a hell lot (you know, like more than 5 mins.. whew), I came across this post:
https://www.mochimedia.com/community/forum/topic/pressing-keys-in-as3

Dammit, it wasn't my code, nor the flash player. It was my Keyboard!
Check out this Wikipedia entry.

Solution:
-Do not use more than 3 regular keys for input.
-For the third key use keys like "Control" or "Shift". Works like a charm!

If you think that I have some old screwed-up keyboard - it was a Vaio. In your face suckaaa!
But apparetly *gaming* keyboards don't have this issue. Boooo-hoooo.

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.