A simple asteroids-like game utilizing various Mbed-compatible sensors
Dependencies: mbed 4DGL-uLCD-SE PinDetect
main.cpp@8:137330cfe63d, 2019-01-03 (annotated)
- Committer:
- sralph3
- Date:
- Thu Jan 03 19:56:27 2019 +0000
- Revision:
- 8:137330cfe63d
- Parent:
- 7:b5372b042ac7
Jan 3, 2019
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
sralph3 | 7:b5372b042ac7 | 1 | // ## MBED INCLUDES ## |
sralph3 | 5:52f97dae8794 | 2 | #include "uLCD_4DGL.h" |
sralph3 | 5:52f97dae8794 | 3 | #include "MMA8452.h" |
sralph3 | 5:52f97dae8794 | 4 | #include "Speaker.h" |
sralph3 | 5:52f97dae8794 | 5 | #include "PinDetect.h" |
sralph3 | 5:52f97dae8794 | 6 | |
sralph3 | 7:b5372b042ac7 | 7 | // ## CUSTOM INCLUDES ## |
sralph3 | 5:52f97dae8794 | 8 | #include "SSE.h" |
sralph3 | 5:52f97dae8794 | 9 | #include "ConcreteAsteroid1.h" |
sralph3 | 5:52f97dae8794 | 10 | #include "ConcreteAsteroid2.h" |
sralph3 | 5:52f97dae8794 | 11 | #include "ConcreteAsteroid3.h" |
sralph3 | 5:52f97dae8794 | 12 | #include "ConcreteAsteroid4.h" |
sralph3 | 5:52f97dae8794 | 13 | #include "overlap.h" |
sralph3 | 5:52f97dae8794 | 14 | |
sralph3 | 7:b5372b042ac7 | 15 | // ## MATH ## |
sralph3 | 5:52f97dae8794 | 16 | #include <math.h> |
sralph3 | 5:52f97dae8794 | 17 | |
sralph3 | 7:b5372b042ac7 | 18 | // ## CUSTOM DEFINES ## |
sralph3 | 5:52f97dae8794 | 19 | #define ASTEROID_HEIGHT 12 |
sralph3 | 5:52f97dae8794 | 20 | #define ASTEROID_WIDTH 15 |
sralph3 | 5:52f97dae8794 | 21 | #define SPRITE_MAX 15 |
sralph3 | 5:52f97dae8794 | 22 | #define EARTH_WIDTH 10 |
sralph3 | 5:52f97dae8794 | 23 | #define EARTH_HEIGHT 10 |
sralph3 | 5:52f97dae8794 | 24 | #define EXPLOSION1_WIDTH 20 |
sralph3 | 5:52f97dae8794 | 25 | |
sralph3 | 5:52f97dae8794 | 26 | #define SCREEN_MAX 125 |
sralph3 | 5:52f97dae8794 | 27 | #define SCREEN_MIN 1 |
sralph3 | 5:52f97dae8794 | 28 | #define NUM_ASTEROIDS 4 |
sralph3 | 5:52f97dae8794 | 29 | |
sralph3 | 5:52f97dae8794 | 30 | #define Q 0x808000 //OLIVE |
sralph3 | 5:52f97dae8794 | 31 | #define I 0x008000 //GREEN |
sralph3 | 5:52f97dae8794 | 32 | #define S 0xC0C0C0 //SILVER |
sralph3 | 5:52f97dae8794 | 33 | #define C 0x17202A //UFO GLASS |
sralph3 | 5:52f97dae8794 | 34 | #define D 0x797D7F //DARK GREY |
sralph3 | 5:52f97dae8794 | 35 | #define L 0x00FF00 //LIME |
sralph3 | 5:52f97dae8794 | 36 | #define P 0xFF00FF //PINK |
sralph3 | 5:52f97dae8794 | 37 | #define R 0xF1C40F //YELLOW |
sralph3 | 5:52f97dae8794 | 38 | #define O 0xF39C12 //ORANGE |
sralph3 | 5:52f97dae8794 | 39 | #define G 0xAAB7B8 //GREY |
sralph3 | 5:52f97dae8794 | 40 | #define _ 0x000000 //BLACK |
sralph3 | 5:52f97dae8794 | 41 | #define X 0xFFFFFF //WHITE |
sralph3 | 5:52f97dae8794 | 42 | #define B 0x0000FF //BLUE |
sralph3 | 5:52f97dae8794 | 43 | #define r 0xFF0000 //RED |
sralph3 | 5:52f97dae8794 | 44 | |
sralph3 | 7:b5372b042ac7 | 45 | // ## VARIOUS MBED INSTANTIATIONS ## |
sralph3 | 5:52f97dae8794 | 46 | uLCD_4DGL uLCD(p28, p27, p29); |
sralph3 | 5:52f97dae8794 | 47 | Serial pc(USBTX,USBRX); |
sralph3 | 7:b5372b042ac7 | 48 | MMA8452 acc(p9, p10, 40000); |
sralph3 | 5:52f97dae8794 | 49 | Speaker mySpeaker(p21); |
sralph3 | 5:52f97dae8794 | 50 | PinDetect pb1(p18); |
sralph3 | 5:52f97dae8794 | 51 | |
sralph3 | 7:b5372b042ac7 | 52 | // ## GLOBAL VARS FOR BOMB BUTTON ## |
sralph3 | 5:52f97dae8794 | 53 | bool BombUsed = false; |
sralph3 | 5:52f97dae8794 | 54 | bool ExplodeAllAsteroids = false; |
sralph3 | 5:52f97dae8794 | 55 | |
sralph3 | 7:b5372b042ac7 | 56 | // ## SET UP PUSHBUTTON FOR INTURRUPT ## |
sralph3 | 5:52f97dae8794 | 57 | void pb1_hit_callback (void) |
sralph3 | 5:52f97dae8794 | 58 | { |
sralph3 | 5:52f97dae8794 | 59 | if (!BombUsed ){ |
sralph3 | 5:52f97dae8794 | 60 | ExplodeAllAsteroids = true; |
sralph3 | 5:52f97dae8794 | 61 | BombUsed = true; |
sralph3 | 5:52f97dae8794 | 62 | mySpeaker.PlayNote(100.0,0.25,0.1); |
sralph3 | 5:52f97dae8794 | 63 | } |
sralph3 | 5:52f97dae8794 | 64 | } |
sralph3 | 7:b5372b042ac7 | 65 | // ## SPRITES ## |
sralph3 | 5:52f97dae8794 | 66 | int asteroid_sprite_1[ASTEROID_HEIGHT * ASTEROID_WIDTH] = { |
sralph3 | 5:52f97dae8794 | 67 | _,_,_,_,X,X,X,X,X,X,X,X,_,_,_, |
sralph3 | 5:52f97dae8794 | 68 | _,_,_,X,_,_,_,_,_,_,_,_,X,_,_, |
sralph3 | 5:52f97dae8794 | 69 | _,_,X,_,_,_,_,_,_,_,_,_,X,_,_, |
sralph3 | 5:52f97dae8794 | 70 | _,X,_,_,_,_,_,_,_,_,_,_,X,_,_, |
sralph3 | 5:52f97dae8794 | 71 | X,X,X,X,_,_,_,_,_,_,_,_,_,X,_, |
sralph3 | 5:52f97dae8794 | 72 | _,_,_,X,_,_,_,_,_,_,_,_,_,X,_, |
sralph3 | 5:52f97dae8794 | 73 | _,_,X,_,_,_,_,_,_,_,_,_,_,X,_, |
sralph3 | 5:52f97dae8794 | 74 | _,X,_,_,_,_,_,X,_,_,_,_,_,X,_, |
sralph3 | 5:52f97dae8794 | 75 | X,_,_,_,_,_,X,X,_,_,_,_,X,_,_, |
sralph3 | 5:52f97dae8794 | 76 | _,X,_,_,_,X,_,X,_,_,_,_,X,_,_, |
sralph3 | 5:52f97dae8794 | 77 | _,_,X,_,X,_,_,X,_,_,_,X,_,_,_, |
sralph3 | 5:52f97dae8794 | 78 | _,_,_,X,_,_,_,X,X,X,X,_,_,_,_ |
sralph3 | 5:52f97dae8794 | 79 | }; |
sralph3 | 5:52f97dae8794 | 80 | |
sralph3 | 5:52f97dae8794 | 81 | int asteroid_sprite_2[ASTEROID_HEIGHT * ASTEROID_WIDTH] = { |
sralph3 | 5:52f97dae8794 | 82 | _,_,_,X,X,_,_,_,_,_,_,_,X,_,_, |
sralph3 | 5:52f97dae8794 | 83 | _,_,X,_,_,X,X,_,_,_,_,X,_,X,_, |
sralph3 | 5:52f97dae8794 | 84 | _,X,_,_,_,_,_,X,X,_,X,_,_,_,X, |
sralph3 | 5:52f97dae8794 | 85 | X,_,_,_,_,_,_,_,_,X,_,_,_,X,_, |
sralph3 | 5:52f97dae8794 | 86 | X,_,_,_,_,_,_,_,_,_,_,_,X,_,_, |
sralph3 | 5:52f97dae8794 | 87 | X,_,_,_,_,_,_,_,_,_,_,_,_,X,_, |
sralph3 | 5:52f97dae8794 | 88 | X,_,_,_,_,_,_,_,_,_,_,_,_,_,X, |
sralph3 | 5:52f97dae8794 | 89 | X,_,_,_,_,_,_,_,_,_,_,_,_,X,_, |
sralph3 | 5:52f97dae8794 | 90 | X,_,_,_,_,_,_,_,_,_,_,_,X,_,_, |
sralph3 | 5:52f97dae8794 | 91 | _,X,_,_,_,_,_,_,_,_,_,_,X,_,_, |
sralph3 | 5:52f97dae8794 | 92 | _,_,X,X,X,_,_,_,_,_,_,X,_,_,_, |
sralph3 | 5:52f97dae8794 | 93 | _,_,_,_,_,X,X,X,X,X,X,_,_,_,_ |
sralph3 | 5:52f97dae8794 | 94 | }; |
sralph3 | 5:52f97dae8794 | 95 | |
sralph3 | 5:52f97dae8794 | 96 | int asteroid_sprite_3[ASTEROID_HEIGHT * ASTEROID_WIDTH] = { |
sralph3 | 5:52f97dae8794 | 97 | _,_,_,_,X,X,X,X,X,_,_,_,_,_,_, |
sralph3 | 5:52f97dae8794 | 98 | _,_,_,_,X,_,_,_,_,X,X,_,_,_,_, |
sralph3 | 5:52f97dae8794 | 99 | _,_,_,_,_,X,_,_,_,_,_,X,X,_,_, |
sralph3 | 5:52f97dae8794 | 100 | _,X,X,X,X,_,_,_,_,_,_,_,_,_,X, |
sralph3 | 5:52f97dae8794 | 101 | X,_,_,_,_,_,_,_,_,_,_,_,_,X,X, |
sralph3 | 5:52f97dae8794 | 102 | X,_,_,_,_,_,_,_,_,_,_,X,X,_,_, |
sralph3 | 5:52f97dae8794 | 103 | X,_,_,_,_,_,_,_,_,_,X,_,_,_,_, |
sralph3 | 5:52f97dae8794 | 104 | X,X,_,_,_,_,_,_,_,_,_,X,X,X,X, |
sralph3 | 5:52f97dae8794 | 105 | _,X,_,_,_,_,_,_,_,_,_,_,_,_,X, |
sralph3 | 5:52f97dae8794 | 106 | _,_,X,_,_,_,_,_,_,X,_,_,_,X,_, |
sralph3 | 5:52f97dae8794 | 107 | _,_,_,X,_,X,X,X,X,_,X,_,X,_,_, |
sralph3 | 5:52f97dae8794 | 108 | _,_,_,_,X,_,_,_,_,_,_,X,_,_,_ |
sralph3 | 5:52f97dae8794 | 109 | }; |
sralph3 | 5:52f97dae8794 | 110 | |
sralph3 | 5:52f97dae8794 | 111 | int asteroid_sprite_4[ASTEROID_HEIGHT * ASTEROID_WIDTH] = { |
sralph3 | 5:52f97dae8794 | 112 | _,_,X,X,X,_,_,_,_,X,X,X,_,_,_, |
sralph3 | 5:52f97dae8794 | 113 | _,X,_,_,X,X,_,_,X,X,_,_,X,_,_, |
sralph3 | 5:52f97dae8794 | 114 | X,_,_,_,_,_,X,X,_,_,_,_,_,X,_, |
sralph3 | 5:52f97dae8794 | 115 | _,X,_,_,_,_,_,_,_,_,_,_,_,_,X, |
sralph3 | 5:52f97dae8794 | 116 | _,_,X,_,_,_,_,_,_,_,_,_,_,X,_, |
sralph3 | 5:52f97dae8794 | 117 | _,_,X,_,_,_,_,_,_,_,_,_,X,_,_, |
sralph3 | 5:52f97dae8794 | 118 | _,_,X,_,_,_,_,_,_,_,_,_,_,X,_, |
sralph3 | 5:52f97dae8794 | 119 | _,X,_,_,_,_,_,_,_,_,_,_,_,_,X, |
sralph3 | 5:52f97dae8794 | 120 | X,_,_,_,_,_,X,_,_,_,_,_,_,X,_, |
sralph3 | 5:52f97dae8794 | 121 | _,X,_,_,_,X,_,X,X,_,_,_,X,_,_, |
sralph3 | 5:52f97dae8794 | 122 | _,_,X,_,X,_,_,_,_,X,X,X,_,_,_, |
sralph3 | 5:52f97dae8794 | 123 | _,_,_,X,_,_,_,_,_,_,_,_,_,_,_ |
sralph3 | 5:52f97dae8794 | 124 | }; |
sralph3 | 5:52f97dae8794 | 125 | |
sralph3 | 5:52f97dae8794 | 126 | int spaceship_earth1[EARTH_WIDTH *EARTH_HEIGHT] = { |
sralph3 | 5:52f97dae8794 | 127 | _,_,S,S,S,S,S,S,_,_, |
sralph3 | 5:52f97dae8794 | 128 | _,S,I,I,I,I,I,I,S,_, |
sralph3 | 5:52f97dae8794 | 129 | S,I,I,I,I,I,I,I,I,S, |
sralph3 | 5:52f97dae8794 | 130 | S,I,I,I,I,I,I,I,I,S, |
sralph3 | 5:52f97dae8794 | 131 | S,I,I,I,I,I,I,I,I,S, |
sralph3 | 5:52f97dae8794 | 132 | S,I,I,I,I,I,I,I,I,S, |
sralph3 | 5:52f97dae8794 | 133 | S,I,I,I,I,I,I,I,I,S, |
sralph3 | 5:52f97dae8794 | 134 | S,I,I,I,I,I,I,I,I,S, |
sralph3 | 5:52f97dae8794 | 135 | S,I,I,I,I,I,I,I,S,_, |
sralph3 | 5:52f97dae8794 | 136 | _,S,S,S,S,S,S,S,_,_, |
sralph3 | 5:52f97dae8794 | 137 | }; |
sralph3 | 5:52f97dae8794 | 138 | int exp1[EARTH_WIDTH *EARTH_HEIGHT] = { |
sralph3 | 5:52f97dae8794 | 139 | _,_,S,S,S,S,S,S,_,_, |
sralph3 | 5:52f97dae8794 | 140 | _,R,r,r,r,r,r,r,S,R, |
sralph3 | 5:52f97dae8794 | 141 | S,r,R,O,O,O,O,r,R,S, |
sralph3 | 5:52f97dae8794 | 142 | S,r,O,R,R,R,R,R,r,S, |
sralph3 | 5:52f97dae8794 | 143 | S,r,O,R,R,R,R,r,r,S, |
sralph3 | 5:52f97dae8794 | 144 | S,r,O,R,R,R,R,r,r,S, |
sralph3 | 5:52f97dae8794 | 145 | S,r,O,R,R,R,r,r,r,S, |
sralph3 | 5:52f97dae8794 | 146 | S,r,R,R,O,O,O,O,O,S, |
sralph3 | 5:52f97dae8794 | 147 | S,r,r,r,O,r,r,r,S,_, |
sralph3 | 5:52f97dae8794 | 148 | _,S,S,S,S,S,S,S,_,_, |
sralph3 | 5:52f97dae8794 | 149 | }; |
sralph3 | 5:52f97dae8794 | 150 | |
sralph3 | 7:b5372b042ac7 | 151 | // ## MAIN ## |
sralph3 | 5:52f97dae8794 | 152 | int main() { |
sralph3 | 7:b5372b042ac7 | 153 | // ## SETUP LCD BAUDRATE, PB PULLUP, AND SRAND ## |
sralph3 | 5:52f97dae8794 | 154 | uLCD.baudrate(300000); |
sralph3 | 7:b5372b042ac7 | 155 | wait(0.2); |
sralph3 | 7:b5372b042ac7 | 156 | pb1.mode(PullUp); |
sralph3 | 7:b5372b042ac7 | 157 | wait(0.1); |
sralph3 | 7:b5372b042ac7 | 158 | srand(time(0)); |
sralph3 | 5:52f97dae8794 | 159 | |
sralph3 | 5:52f97dae8794 | 160 | |
sralph3 | 7:b5372b042ac7 | 161 | // ## SET PARAMETERS FOR ACCELEROMETER ## |
sralph3 | 7:b5372b042ac7 | 162 | acc.setBitDepth(MMA8452::BIT_DEPTH_12); |
sralph3 | 7:b5372b042ac7 | 163 | acc.setDynamicRange(MMA8452::DYNAMIC_RANGE_4G); |
sralph3 | 7:b5372b042ac7 | 164 | acc.setDataRate(MMA8452::RATE_100); |
sralph3 | 7:b5372b042ac7 | 165 | |
sralph3 | 7:b5372b042ac7 | 166 | // ## SETUP INTURRUPT CALLBACK FUNCTION FOR A PB HIT ## |
sralph3 | 5:52f97dae8794 | 167 | pb1.attach_deasserted(&pb1_hit_callback); |
sralph3 | 7:b5372b042ac7 | 168 | // ## START SAMPLING PB CALLBACK ## |
sralph3 | 5:52f97dae8794 | 169 | pb1.setSampleFrequency(); |
sralph3 | 5:52f97dae8794 | 170 | |
sralph3 | 7:b5372b042ac7 | 171 | // ## CREATE ARRAY OF SCREENOBJECTS (AND SHIP) ## |
sralph3 | 7:b5372b042ac7 | 172 | ScreenObject *AstAry[NUM_ASTEROIDS]; |
sralph3 | 5:52f97dae8794 | 173 | AstAry[0] = new ConcreteAsteroid1; |
sralph3 | 5:52f97dae8794 | 174 | AstAry[1] = new ConcreteAsteroid2; |
sralph3 | 5:52f97dae8794 | 175 | AstAry[2] = new ConcreteAsteroid3; |
sralph3 | 5:52f97dae8794 | 176 | AstAry[3] = new ConcreteAsteroid4; |
sralph3 | 5:52f97dae8794 | 177 | SSE ship; |
sralph3 | 5:52f97dae8794 | 178 | |
sralph3 | 7:b5372b042ac7 | 179 | // ## SETUP TIME & ELAPSED TIME ## |
sralph3 | 5:52f97dae8794 | 180 | time_t startTime; |
sralph3 | 5:52f97dae8794 | 181 | startTime = time(0); |
sralph3 | 5:52f97dae8794 | 182 | time_t timeElapsed = time(0)-startTime; |
sralph3 | 7:b5372b042ac7 | 183 | |
sralph3 | 7:b5372b042ac7 | 184 | // ## GAME LOOP ## |
sralph3 | 5:52f97dae8794 | 185 | while (true){ |
sralph3 | 5:52f97dae8794 | 186 | uLCD.cls(); |
sralph3 | 5:52f97dae8794 | 187 | |
sralph3 | 7:b5372b042ac7 | 188 | // ## TAKE TIME ELAPSED, CONVERT TO OUT OF 30SEC, SCALE TO SCREN SIZE ## |
sralph3 | 5:52f97dae8794 | 189 | timeElapsed = time(0)-startTime; |
sralph3 | 5:52f97dae8794 | 190 | double t = (double)timeElapsed; |
sralph3 | 5:52f97dae8794 | 191 | double tw = (t/30)*SCREEN_MAX; |
sralph3 | 5:52f97dae8794 | 192 | uLCD.filled_rectangle(0, 0 , SCREEN_MAX-ceil(tw) , 5, G); |
sralph3 | 5:52f97dae8794 | 193 | |
sralph3 | 7:b5372b042ac7 | 194 | // ## WINNING IF STATEMENT ## |
sralph3 | 6:7b71038ea3df | 195 | if (timeElapsed >= 30){ |
sralph3 | 5:52f97dae8794 | 196 | mySpeaker.PlayNote(600.0,0.25,0.2); |
sralph3 | 5:52f97dae8794 | 197 | mySpeaker.PlayNote(800.0,0.25,0.1); |
sralph3 | 5:52f97dae8794 | 198 | mySpeaker.PlayNote(900.0,0.25,0.1); |
sralph3 | 5:52f97dae8794 | 199 | uLCD.printf("\nYOU WIN!\n PRESS BUTTON TO\n RESTART"); |
sralph3 | 5:52f97dae8794 | 200 | wait(1); |
sralph3 | 5:52f97dae8794 | 201 | return 0; |
sralph3 | 5:52f97dae8794 | 202 | } |
sralph3 | 5:52f97dae8794 | 203 | |
sralph3 | 7:b5372b042ac7 | 204 | // ## BOMB IF STATEMENT ## |
sralph3 | 5:52f97dae8794 | 205 | if (ExplodeAllAsteroids){ |
sralph3 | 5:52f97dae8794 | 206 | for(int i=0; i < NUM_ASTEROIDS; i++){ |
sralph3 | 5:52f97dae8794 | 207 | int rando = (rand() % 4); |
sralph3 | 5:52f97dae8794 | 208 | |
sralph3 | 5:52f97dae8794 | 209 | if (rando == 0) { |
sralph3 | 5:52f97dae8794 | 210 | AstAry[i] = new ConcreteAsteroid1; |
sralph3 | 5:52f97dae8794 | 211 | } else if (rando == 1) { |
sralph3 | 5:52f97dae8794 | 212 | AstAry[i] = new ConcreteAsteroid2; |
sralph3 | 5:52f97dae8794 | 213 | } else if (rando == 2) { |
sralph3 | 5:52f97dae8794 | 214 | AstAry[i] = new ConcreteAsteroid3; |
sralph3 | 5:52f97dae8794 | 215 | } else { |
sralph3 | 5:52f97dae8794 | 216 | AstAry[i] = new ConcreteAsteroid4; |
sralph3 | 5:52f97dae8794 | 217 | } |
sralph3 | 5:52f97dae8794 | 218 | } |
sralph3 | 5:52f97dae8794 | 219 | ExplodeAllAsteroids = false; |
sralph3 | 5:52f97dae8794 | 220 | } |
sralph3 | 5:52f97dae8794 | 221 | |
sralph3 | 5:52f97dae8794 | 222 | ship.update(); |
sralph3 | 5:52f97dae8794 | 223 | |
sralph3 | 7:b5372b042ac7 | 224 | // ## LOOP THROUGH ASTROID ARY, SEE IF OOB ## |
sralph3 | 5:52f97dae8794 | 225 | for(int i=0; i < NUM_ASTEROIDS; i++){ |
sralph3 | 5:52f97dae8794 | 226 | AstAry[i]->update(); |
sralph3 | 5:52f97dae8794 | 227 | if(AstAry[i]->outB()){ |
sralph3 | 5:52f97dae8794 | 228 | int rando = (rand() % 4); |
sralph3 | 5:52f97dae8794 | 229 | |
sralph3 | 5:52f97dae8794 | 230 | if (rando == 0) { |
sralph3 | 5:52f97dae8794 | 231 | AstAry[i] = new ConcreteAsteroid1; |
sralph3 | 5:52f97dae8794 | 232 | } else if (rando == 1) { |
sralph3 | 5:52f97dae8794 | 233 | AstAry[i] = new ConcreteAsteroid2; |
sralph3 | 5:52f97dae8794 | 234 | } else if (rando == 2) { |
sralph3 | 5:52f97dae8794 | 235 | AstAry[i] = new ConcreteAsteroid3; |
sralph3 | 5:52f97dae8794 | 236 | } else { |
sralph3 | 5:52f97dae8794 | 237 | AstAry[i] = new ConcreteAsteroid4; |
sralph3 | 5:52f97dae8794 | 238 | } |
sralph3 | 5:52f97dae8794 | 239 | } |
sralph3 | 5:52f97dae8794 | 240 | |
sralph3 | 7:b5372b042ac7 | 241 | // ## LOSING IF STATEMENT ## |
sralph3 | 5:52f97dae8794 | 242 | if(overlap( ship, *AstAry[i])){ |
sralph3 | 5:52f97dae8794 | 243 | uLCD.BLIT(ship.xpos, ship.ypos, EARTH_WIDTH, EARTH_HEIGHT, exp1); |
sralph3 | 5:52f97dae8794 | 244 | mySpeaker.PlayNote(800.0,0.25,0.1); |
sralph3 | 5:52f97dae8794 | 245 | mySpeaker.PlayNote(400.0,0.25,0.1); |
sralph3 | 5:52f97dae8794 | 246 | mySpeaker.PlayNote(200.0,0.25,0.1); |
sralph3 | 5:52f97dae8794 | 247 | uLCD.printf("\nGAME OVER\n"); |
sralph3 | 5:52f97dae8794 | 248 | wait(2); |
sralph3 | 5:52f97dae8794 | 249 | return 0; |
sralph3 | 5:52f97dae8794 | 250 | } |
sralph3 | 5:52f97dae8794 | 251 | AstAry[i]->draw(); |
sralph3 | 5:52f97dae8794 | 252 | } |
sralph3 | 5:52f97dae8794 | 253 | ship.draw(); |
sralph3 | 5:52f97dae8794 | 254 | wait(.1); |
sralph3 | 5:52f97dae8794 | 255 | } |
sralph3 | 5:52f97dae8794 | 256 | } |