Monster Racer Rush
Select between 5 monster racers, upgrade your monster skill and win the competition!
4.23 / 5.00 3,881 ViewsBuild and Base
Build most powerful forces, unleash hordes of monster and control your soldiers!
3.93 / 5.00 4,634 ViewsCurrently, when I play this game I'm working on, I noticed that when I'm pressing the spacebar to fire bullets, I cannot move the player in a Northwest direction by pressing the Up and Left key together. I can movie in all 7 other directions by pressing other keys together or by themselves, but I'm only not able to use Up and Left together while holding the Spacebar. If I release the spacebar I can move Northwest again.
Here's the demo so you can see what I mean.
Here's the Keyboard code as far as I think you need to see:
in my Player.as:
private function PressAKey(event:KeyboardEvent):void
{
if(event.keyCode == 39)
{
rightKey = true;
}
if(event.keyCode == 37)
{
leftKey = true;
}
if(event.keyCode == 38)
{
upKey = true;
}
if(event.keyCode == 40)
{
downKey = true;
}
}
and my spacebar code in my DocumentClass.as:
private function onSpaceDown(event:KeyboardEvent):void
{
if(event.keyCode == 32)
{
isFiring = true;
isSideFiring = true;
}
}
private function onSpaceUp(event:KeyboardEvent):void
{
if(event.keyCode == 32)
{
isFiring = false;
isSideFiring = false;
}
}
This is a new issue ever since I decided to use the spacebar instead of the mouse to fire bullets. Maybe I could just introduce some kind of auto-fire to avoid the problem, I assume, entirely.
Has anyone heard of any issue like this before? If you need to see more code, just ask.
issue could be with keyboard, only so many keys can be pressed at same time.
Alternatively try binding fire action on some other key and see if it resolve issue, or use wasd for movement
RangeError: Error #1125: The index 4 is out of range 4.
Nothing you can do about that. Switch keys or implement auto fire.
At 8/10/13 07:35 AM, nitokov wrote: issue could be with keyboard, only so many keys can be pressed at same time.
Alternatively try binding fire action on some other key and see if it resolve issue, or use wasd for movement
It's not the number of key being pressed. I can press upwards of 4 at a time on this keyboard. I'm able to hold spacebar and still press "Down" and "Right". Those register. The only combination I can't seem to use is "Up" and "Left".
At 8/10/13 11:59 AM, Barzona wrote:At 8/10/13 07:35 AM, nitokov wrote: issue could be with keyboard, only so many keys can be pressed at same time.It's not the number of key being pressed. I can press upwards of 4 at a time on this keyboard. I'm able to hold spacebar and still press "Down" and "Right". Those register. The only combination I can't seem to use is "Up" and "Left".
Alternatively try binding fire action on some other key and see if it resolve issue, or use wasd for movement
It's not just about the number of keys, but what those keys are. I remember someone mentioning how, due to the way keyboards are made, like the keys are in "groups", so you can't press that specific key combination.
At 8/10/13 12:24 PM, 4urentertainment wrote: It's not just about the number of keys, but what those keys are. I remember someone mentioning how, due to the way keyboards are made, like the keys are in "groups", so you can't press that specific key combination.
that's a sign of a bad keyboard, but yeah. A lot of people have bad keyboards.
Programming stuffs (tutorials and extras)
PM me (instead of MintPaw) if you're confuzzled.
thank Skaren for the sig :P
I can do it on my Logitech G105 keyboard, so your code works fine.
You'll need to buy a better keyboard if you want it to work for you as well. Though as egg82 pointed out most users won't have a good enough keyboard for it to work, so I wouldn't recommend designing your game around it. One solution could be to let the user define the keys themselves, since it's possible that on their keyboard a different combination will work.
At 8/11/13 08:47 PM, Diki wrote: I can do it on my Logitech G105 keyboard, so your code works fine.
You'll need to buy a better keyboard if you want it to work for you as well. Though as egg82 pointed out most users won't have a good enough keyboard for it to work, so I wouldn't recommend designing your game around it. One solution could be to let the user define the keys themselves, since it's possible that on their keyboard a different combination will work.
Yeah, letting them decide would be cool. A little overboard for just a little flash game, but I could do it anyway. However, I still need to decide on a decent default setting. Maybe switching to WASD would fix the issue.