Skip to content

Commit

Permalink
Change pause combo for analogue pocket compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
epbarger committed Sep 16, 2023
1 parent b2857b0 commit 36e7fa0
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions night-raid.ino
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ byte cursorX = 63;
byte cursorY = 26;
bool transitionLock = false;
byte missileSpawnFrameDelay = MISSILE_FRAME_DELAY;
bool pauseLock = false;

///////////////////////////////////////

Expand Down Expand Up @@ -193,12 +194,13 @@ void drawState(){

///////////////////////////////////////
void updateCursor(){
if (arduboy.pressed(LEFT_BUTTON)
&& arduboy.pressed(RIGHT_BUTTON)
if (arduboy.pressed(A_BUTTON)
&& arduboy.pressed(B_BUTTON)
&& arduboy.pressed(UP_BUTTON)
&& arduboy.pressed(DOWN_BUTTON)
&& !pendingLoss){
gameState = PAUSED;
pauseLock = true;
gameState = PAUSED;
return;
}

// TODO cursor acceleration?
Expand Down Expand Up @@ -830,7 +832,10 @@ void checkForLoss(){
}

void pauseHandler(){
if (arduboy.pressed(A_BUTTON) || arduboy.pressed(B_BUTTON)){
if (pauseLock && !arduboy.pressed(A_BUTTON) && !arduboy.pressed(B_BUTTON)) {
pauseLock = false;
}
if (!pauseLock && (arduboy.pressed(A_BUTTON) || arduboy.pressed(B_BUTTON))){
bFired = true;
aFired = true;
gameState = PLAYING;
Expand Down

0 comments on commit 36e7fa0

Please sign in to comment.