Mezmure Dargie / Mbed 2 deprecated SPACERACERS

Dependencies:   4DGL-uLCD-SE PinDetect mbed wave_player

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers Alien.h Source File

Alien.h

00001 #include "uLCD_4DGL.h"
00002 #include "mbed.h"
00003 extern uLCD_4DGL uLCD;
00004 
00005 class Alien 
00006 {
00007     public: 
00008     int oldx, oldy, x, y; 
00009     bool alive;
00010     Alien() {}
00011     Alien(int xx, int yy) { //starting position
00012         oldx = xx;
00013         oldy = yy;
00014         x = xx;
00015         y = yy;
00016         alive = true;
00017         }
00018         
00019     void draw() {
00020         
00021 //        if (x != oldx) {
00022 //            uLCD.filled_circle(x,y,4,BLACK);
00023 //            uLCD.filled_rectangle(x-5, y+6,x-3, y+4,BLACK);
00024 //            uLCD.filled_rectangle(x+3,y+6,x+5,y+4,BLACK);
00025 //            uLCD.filled_circle(x-2,y-1,1.5,BLACK);
00026 //            uLCD.filled_circle(x+2,y-1,1.5,BLACK);
00027 //            }
00028 //            uLCD.triangle( x-3, y+3 ,x,y, x+3, y+3, GREEN); 
00029             uLCD.filled_circle(x,y,4,GREEN);
00030             uLCD.filled_rectangle(x-5, y+6,x-3, y+4,GREEN);
00031             uLCD.filled_rectangle(x+3,y+6,x+5,y+4,GREEN);
00032             uLCD.filled_circle(x-2,y-1,1.5,RED);
00033             uLCD.filled_circle(x+2,y-1,1.5,RED);
00034         }
00035         
00036         void erase() {
00037 //            uLCD.triangle( x-3, y+3 ,x,y, x+3, y+3, GREEN); 
00038             uLCD.filled_circle(x,y,4,BLACK);
00039             uLCD.filled_rectangle(x-5, y+6,x-3, y+4,BLACK);
00040             uLCD.filled_rectangle(x+3,y+6,x+5,y+4,BLACK);
00041             uLCD.filled_circle(x-2,y-1,1.5,BLACK);
00042             uLCD.filled_circle(x+2,y-1,1.5,BLACK);
00043             
00044         }
00045     };