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

Dependents:   Starship

Committer:
Oshyrath
Date:
Sun Sep 17 17:05:27 2017 +0000
Revision:
0:c9afe145b57b
Child:
1:527a11035e0b
This is the first push for Starship game for STM32F429i-DISC1.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Oshyrath 0:c9afe145b57b 1 #include "Player.h"
Oshyrath 0:c9afe145b57b 2 void movePlayer(uint8_t x_vel, uint8_t y_vel)
Oshyrath 0:c9afe145b57b 3 {
Oshyrath 0:c9afe145b57b 4 player.x_pos += x_vel;
Oshyrath 0:c9afe145b57b 5 player.y_pos -= y_vel;
Oshyrath 0:c9afe145b57b 6 if(player.x_pos<=0)
Oshyrath 0:c9afe145b57b 7 player.x_pos=0;
Oshyrath 0:c9afe145b57b 8 else if(player.x_pos>=LCD_WIDTH-PLAYER_WIDTH)
Oshyrath 0:c9afe145b57b 9 player.x_pos = LCD_WIDTH-PLAYER_WIDTH;
Oshyrath 0:c9afe145b57b 10 if(player.y_pos<=0)
Oshyrath 0:c9afe145b57b 11 player.y_pos = 0;
Oshyrath 0:c9afe145b57b 12 else if(player.y_pos>=LCD_HEIGHT-PLAYER_HEIGHT)
Oshyrath 0:c9afe145b57b 13 player.y_pos = LCD_HEIGHT-PLAYER_HEIGHT;
Oshyrath 0:c9afe145b57b 14 }
Oshyrath 0:c9afe145b57b 15 void updatePlayerTimers()
Oshyrath 0:c9afe145b57b 16 {
Oshyrath 0:c9afe145b57b 17 player.rapidFireTimer = player.rapidFireTimer ? player.rapidFireTimer-1 : 0;
Oshyrath 0:c9afe145b57b 18 player.powerShotTimer = player.powerShotTimer ? player.powerShotTimer-1 : 0;
Oshyrath 0:c9afe145b57b 19 player.wideShotTimer = player.wideShotTimer ? player.wideShotTimer-1 : 0;
Oshyrath 0:c9afe145b57b 20 player.shieldTimer = player.shieldTimer ? player.shieldTimer-1 : 0;
Oshyrath 0:c9afe145b57b 21 player.gunTimer = player.gunTimer ? player.gunTimer-1 : 0;
Oshyrath 0:c9afe145b57b 22 }