![](/media/cache/profiles/fa1fc368935a59b748bec5e15aca97ea.jpg.50x50_q85.png)
This code contains the game Starship designed for the STM32F429i-DISC1 board. It requires a keyboard to play.
Dependencies: Starship LCD_DISCO_F429ZI USBHost mbed
Player.c
- Committer:
- Oshyrath
- Date:
- 2017-09-17
- Revision:
- 0:c9afe145b57b
- Child:
- 1:527a11035e0b
File content as of revision 0:c9afe145b57b:
#include "Player.h" void movePlayer(uint8_t x_vel, uint8_t y_vel) { player.x_pos += x_vel; player.y_pos -= y_vel; if(player.x_pos<=0) player.x_pos=0; else if(player.x_pos>=LCD_WIDTH-PLAYER_WIDTH) player.x_pos = LCD_WIDTH-PLAYER_WIDTH; if(player.y_pos<=0) player.y_pos = 0; else if(player.y_pos>=LCD_HEIGHT-PLAYER_HEIGHT) player.y_pos = LCD_HEIGHT-PLAYER_HEIGHT; } void updatePlayerTimers() { player.rapidFireTimer = player.rapidFireTimer ? player.rapidFireTimer-1 : 0; player.powerShotTimer = player.powerShotTimer ? player.powerShotTimer-1 : 0; player.wideShotTimer = player.wideShotTimer ? player.wideShotTimer-1 : 0; player.shieldTimer = player.shieldTimer ? player.shieldTimer-1 : 0; player.gunTimer = player.gunTimer ? player.gunTimer-1 : 0; }