Mission Control Code for Interactive Alarm Clock

Dependencies:   4DGL-uLCD-SE mbed

player.cpp

Committer:
tshin7
Date:
2015-12-10
Revision:
0:02b0b24dedd1

File content as of revision 0:02b0b24dedd1:

#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);
            }
            
            }