I am developing a small enemy plane shooter game using HTML5 and Javascript. In the game I implemented the bulletFiring of the shooter plane using the EventHandler of keypress and then I am using the setInterval method to periodically change the look of the canvas where the bullets are drawn. So in the game while I am moving the plane up and down and then pressing the fire key the plane stops moving(both keys pressed simultaneously).
function move(e)
{
if(e.keyCode==40)
{
//Move the jet down
}
else if(e.keyCode==38)
{
//Move the Jet Up
}
else if(e.keyCode==32)//Space Bar
{
//Fire the bullet
}
}
So when I press both SPACE and UP keys then space key event-handler is occurring but not of the UP key and the plane stops moving. Can someone help me how to keep both events in parallel so that one does not stop the other from happening.