Missile Control Game with uLCD
Dependencies: 4DGL-uLCD-SE SDFileSystem mbed wave_player
Fork of missile_command by
player.cpp
- Committer:
- ajindia6
- Date:
- 2015-10-20
- Revision:
- 2:eba4ed0263a4
- Parent:
- 0:532cb55d6136
File content as of revision 2:eba4ed0263a4:
#include "mbed.h" #include "uLCD_4DGL.h" #include "globals.h" #include "player.h" //Initialize antimissile status PLAYER_MISSILE_STATUS status; //Function to draw the player void player_draw(int x, int y) { uLCD.filled_rectangle(x, y, x+PLAYER_WIDTH, y+PLAYER_HEIGHT, 0xFFA500); uLCD.filled_rectangle(x+PLAYER_DELTA, y-PLAYER_DELTA, x+PLAYER_WIDTH-PLAYER_DELTA, y+PLAYER_HEIGHT, 0xFF0000); uLCD.filled_rectangle(x,y, x+PLAYER_WIDTH/4, y+2+PLAYER_HEIGHT, 0xFFA500); uLCD.filled_rectangle(x+8, y, x+PLAYER_WIDTH, y+2+PLAYER_HEIGHT, 0xFFA500); } //Function to delete player void player_delete(int x, int y) { uLCD.filled_rectangle(x, y, x+PLAYER_WIDTH, y+PLAYER_HEIGHT, BLACK_COLOR); uLCD.filled_rectangle(x+PLAYER_DELTA, y-PLAYER_DELTA, x+PLAYER_WIDTH-PLAYER_DELTA, y+PLAYER_HEIGHT, BLACK_COLOR); uLCD.filled_rectangle(x,y, x+PLAYER_WIDTH/4, y+2+PLAYER_HEIGHT, BLACK_COLOR); uLCD.filled_rectangle(x+8, y, x+PLAYER_WIDTH, y+2+PLAYER_HEIGHT, BLACK_COLOR); } void gameover(int s) { while(1) { uLCD.filled_rectangle(0, 0, 128, 128, 0x000000); uLCD.locate(4, 5); uLCD.printf("GAME OVER \n \n"); uLCD.printf("YOUR SCORE WAS:%2d",s); wait(1); } }