I’m trying to do something for a situation where the user is holding multiple keys. The game records the order in which they were pressed into an Array and on Input.released
that key will be spliced from the Array. This is so as the player releases keys, of the remaining held, only the last one in the Array will be processed. The problem I’m running into is that Input.check
seems to only process, at the most, 3 keys held, but usually 2. I made a basic Entity just to test:
public class Test3 extends Entity
{
public function Test3(x:Number=0, y:Number=0, graphic:Graphic=null, mask:Mask=null)
{
super(x, y, graphic, mask);
}
override public function update():void
{
super.update();
updateInput();
}
private function updateInput():void
{
if (Input.check(Key.UP)) trace("UP");
if (Input.check(Key.RIGHT)) trace("RIGHT");
if (Input.check(Key.DOWN)) trace("DOWN");
if (Input.check(Key.LEFT)) trace("LEFT");
}
}
Lets say I press and hold, in order, Key.LEFT
, Key.UP
, Key.RIGHT
. Output traces LEFT UP LEFT UP LEFT UP LEFT UP LEFT UP LEFT UP LEFT UP
. Does not trace RIGHT
.