Arnav Jindia / Mbed 2 deprecated Missile_Control_Game

Dependencies:   4DGL-uLCD-SE SDFileSystem mbed wave_player

Fork of missile_command by ECE 2035 TA

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers player.cpp Source File

player.cpp

00001 #include "mbed.h"
00002 #include "uLCD_4DGL.h"
00003 #include "globals.h"
00004 #include "player.h"
00005 
00006 //Initialize antimissile status
00007 PLAYER_MISSILE_STATUS status;
00008 
00009 
00010 
00011 
00012     
00013 //Function to draw the player
00014 void player_draw(int x, int y) {
00015     uLCD.filled_rectangle(x, y, x+PLAYER_WIDTH, y+PLAYER_HEIGHT, 0xFFA500); 
00016     uLCD.filled_rectangle(x+PLAYER_DELTA, y-PLAYER_DELTA, x+PLAYER_WIDTH-PLAYER_DELTA, y+PLAYER_HEIGHT, 0xFF0000);
00017     uLCD.filled_rectangle(x,y, x+PLAYER_WIDTH/4, y+2+PLAYER_HEIGHT, 0xFFA500);
00018     uLCD.filled_rectangle(x+8, y, x+PLAYER_WIDTH, y+2+PLAYER_HEIGHT, 0xFFA500);    
00019 }
00020 
00021 //Function to delete player
00022 void player_delete(int x, int y) {
00023     uLCD.filled_rectangle(x, y, x+PLAYER_WIDTH, y+PLAYER_HEIGHT, BLACK_COLOR); 
00024     uLCD.filled_rectangle(x+PLAYER_DELTA, y-PLAYER_DELTA, x+PLAYER_WIDTH-PLAYER_DELTA, y+PLAYER_HEIGHT, BLACK_COLOR);
00025     uLCD.filled_rectangle(x,y, x+PLAYER_WIDTH/4, y+2+PLAYER_HEIGHT, BLACK_COLOR);
00026     uLCD.filled_rectangle(x+8, y, x+PLAYER_WIDTH, y+2+PLAYER_HEIGHT, BLACK_COLOR);     
00027 }
00028 
00029 
00030 void gameover(int s) {
00031             
00032             while(1) {
00033             uLCD.filled_rectangle(0, 0, 128, 128, 0x000000);
00034             uLCD.locate(4, 5);
00035             uLCD.printf("GAME OVER \n \n");
00036             uLCD.printf("YOUR SCORE WAS:%2d",s);
00037             wait(1);
00038             }
00039             
00040             }
00041             
00042 
00043             
00044             
00045             
00046             
00047             
00048             
00049             
00050             
00051             
00052             
00053         
00054