accelerometer moving paddle fully out
This commit is contained in:
@@ -82,6 +82,7 @@ typedef struct {
|
|||||||
bool paddle_hit;
|
bool paddle_hit;
|
||||||
bool paddle_released;
|
bool paddle_released;
|
||||||
uint8_t curr_freq;
|
uint8_t curr_freq;
|
||||||
|
bool moving_from_tap;
|
||||||
} game_state_t;
|
} game_state_t;
|
||||||
|
|
||||||
static game_state_t game_state;
|
static game_state_t game_state;
|
||||||
@@ -272,7 +273,7 @@ static void update_paddle(void) {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case PADDLE_EXTENDING:
|
case PADDLE_EXTENDING:
|
||||||
if (!HAL_GPIO_BTN_ALARM_read()) {
|
if (!game_state.moving_from_tap && !HAL_GPIO_BTN_ALARM_read()) {
|
||||||
game_state.paddle_pos = PADDLE_RETRACTED;
|
game_state.paddle_pos = PADDLE_RETRACTED;
|
||||||
} else {
|
} else {
|
||||||
game_state.paddle_pos = PADDLE_EXTENDED;
|
game_state.paddle_pos = PADDLE_EXTENDED;
|
||||||
@@ -285,6 +286,7 @@ static void update_paddle(void) {
|
|||||||
case PADDLE_RETRACTING:
|
case PADDLE_RETRACTING:
|
||||||
game_state.paddle_pos = PADDLE_RETRACTED;
|
game_state.paddle_pos = PADDLE_RETRACTED;
|
||||||
watch_display_character(' ', 8);
|
watch_display_character(' ', 8);
|
||||||
|
game_state.moving_from_tap = false;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
@@ -580,9 +582,14 @@ bool ping_face_loop(movement_event_t event, void *context) {
|
|||||||
display_score_screen(state);
|
display_score_screen(state);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
//fall through
|
else if (game_state.curr_screen == SCREEN_PLAYING){
|
||||||
|
game_state.moving_from_tap = true;
|
||||||
|
game_state.paddle_hit = true;
|
||||||
|
}
|
||||||
|
break;
|
||||||
case EVENT_ALARM_BUTTON_DOWN:
|
case EVENT_ALARM_BUTTON_DOWN:
|
||||||
if (game_state.curr_screen == SCREEN_PLAYING){
|
if (game_state.curr_screen == SCREEN_PLAYING){
|
||||||
|
game_state.moving_from_tap = false;
|
||||||
game_state.paddle_hit = true;
|
game_state.paddle_hit = true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -33,7 +33,7 @@
|
|||||||
https://www.instagram.com/reel/DNlTb-ERE1F/
|
https://www.instagram.com/reel/DNlTb-ERE1F/
|
||||||
On the title screen, you can select a difficulty by long-pressing LIGHT or toggle sound by long-pressing ALARM.
|
On the title screen, you can select a difficulty by long-pressing LIGHT or toggle sound by long-pressing ALARM.
|
||||||
ALARM are used to paddle. Holding the ALARM button longer makes the paddle travel further.
|
ALARM are used to paddle. Holding the ALARM button longer makes the paddle travel further.
|
||||||
If the accelerometer is installed, you can tap the screen to move the paddle.
|
If the accelerometer is installed, you can tap the screen to move the paddle. Paddle will travel its full distance when tapping is used.
|
||||||
High-score is displayed on the top-right on the title screen. During a game, the current score is displayed.
|
High-score is displayed on the top-right on the title screen. During a game, the current score is displayed.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user