Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: 4DGL-uLCD-SE PinDetect mbed wave_player
Spaceship.h
00001 #include "uLCD_4DGL.h" 00002 00003 extern uLCD_4DGL uLCD; 00004 class Spaceship 00005 { 00006 public: 00007 int x, y, hits; 00008 bool alive; 00009 00010 Spaceship() { //starting position 00011 x = 0; 00012 y = 127; 00013 hits = 0; 00014 alive = true; 00015 } 00016 void draw() { 00017 if ( x + 3 < 128) { //make sure ship doesn't pass right edge 00018 uLCD.filled_circle(x , y , 4 , BLUE); 00019 } 00020 } 00021 void erase() { 00022 uLCD.filled_circle(x , y , 4, BLACK); 00023 } 00024 bool isAlive() { // Dies if hit 3 times 00025 if (hits >=3) 00026 { 00027 alive = false; 00028 } 00029 return alive; } 00030 }; 00031
Generated on Tue Jul 26 2022 17:28:07 by
1.7.2