I know...in order to save some CPU power, the level and sprites are only refreshed when the arrows keys are pressed, which is at most 10 times a second (there's a time-limiter on the key presses, so you don't fly around the level at uncontrollable speeds).
The check for the spacebar is in the refreshing function, so it's only called when used in conjunction with an arrow key. I'll rework this, I think. But so that is checks which arrow key is pressed (as one must be) and thereby allow you to pick which gate to unlock should there be two right near by. Forward thinking!
EDIT:
if (((levelProperties[playerX][playerY]==gate)||(levelProperties[playerX+1][playerY]==gate)||(levelProperties[playerX-1][playerY]==gate)||(levelProperties[playerX][playerY-1]==gate)||(levelProperties[playerX][playerY+1]==gate))&&(dbSpaceKey())&&(playerPills>0)){
if((playerPills>0)&&(levelProperties[playerX-1][playerY]==gate)&&(dbLeftKey())){
levelProperties[playerX-1][playerY]=0;
playerPills--;
}
if((playerPills>0)&&(levelProperties[playerX+1][playerY]==gate)&&(dbRightKey())){
levelProperties[playerX+1][playerY]=0;
playerPills--;
}
if((playerPills>0)&&(levelProperties[playerX][playerY-1]==gate)&&(dbUpKey())){
levelProperties[playerX][playerY-1]=0;
playerPills--;
}
if((playerPills>0)&&(levelProperties[playerX][playerY+1]==gate)&&(dbDownKey())){
levelProperties[playerX][playerY+1]=0;
playerPills--;
}
That fixes it up, and it's much smoother. Now you push the key in the direction of the gate, and press space.
By the way, what do you think of the simply
amazing menu? I meant for it to be rather simple, because I made it in literally one minute. I kind of like it though.
My site, for various stuff that I make.