![]() |
Zap'Em Blast'Em Robots
robots that play laser tag!
|
State machine for Zap'em Blast'em Robots game control logic. More...
#include "motor_driver.h"
#include "game_task.h"
#include "sound_task.h"
#include "photoresistor_task.h"
#include "stm32f4xx_hal_tim.h"
#include "stm32f4xx_it.h"
#include "lcd.h"
#include <stdio.h>
Functions | |
void | game_task_run (GameTask *game_task) |
Runs the current state of the GameTask. | |
void | game_task_state_0_init (GameTask *game_task) |
Initializes the game task (state 0). | |
void | game_task_state_1_home (GameTask *game_task) |
Waits for player to initiate the game (state 1). | |
void | game_task_state_2_play (GameTask *game_task) |
Handles gameplay logic and scoring (state 2). | |
void | game_task_state_3_end (GameTask *game_task) |
Displays game over screen and resets (state 3). |
State machine for Zap'em Blast'em Robots game control logic.
Created on: May 22, 2025
void game_task_run | ( | GameTask * | game_task | ) |
void game_task_state_0_init | ( | GameTask * | game_task | ) |
Initializes the game task (state 0).
Clears and sets up the LCD, then advances to state 1.
game_task | Pointer to the GameTask instance. |
void game_task_state_1_home | ( | GameTask * | game_task | ) |
Waits for player to initiate the game (state 1).
Displays title and instructions. When play_flag is set, transitions to the next state and triggers the start sound.
game_task | Pointer to the GameTask instance. |
void game_task_state_2_play | ( | GameTask * | game_task | ) |
Handles gameplay logic and scoring (state 2).
Increments scores based on photoresistor hit flags, updates LCD with score, and transitions to end state when a score threshold is reached.
game_task | Pointer to the GameTask instance. |