Arduino Nano Space Invaders
Space Invaders clone using TVout libraries
Components and supplies
Rotary Potentiometer, 100 kohm
Arduino Nano R3
Resistor 100k ohm
Through Hole Resistor, 470 ohm
Resistor 1k ohm
Pushbutton Switch, Momentary
Project description
Code
bitmap.h
arduino
1/** 2 * Space Invaders - aliens definition 3 * 4 */ 5 6//alien 1 7PROGMEM const unsigned char a1a[] = { 88, 8, //pictureresolution 9 0x18,0x7E,0xFF,0xDB,0xFF,0x66,0xDB,0x42 10}; 11 12//alien 1 13PROGMEM const unsigned char a1b[] = { 148, 8, //pictureresolution 15 0x18,0x7E,0xFF,0xDB,0xFF,0x24,0x5A,0x81 16}; 17 18//alien 2 19PROGMEM const unsigned char a2a[] = { 208, 8, //pictureresolution 21 0x42,0x24,0x7E,0xDB,0xFF,0xBD,0xA5,0x24 22}; 23 24//alien 2 25PROGMEM const unsigned char a2b[] = { 268, 8, //pictureresolution 27 0x42,0x24,0xBD,0xDB,0xFF,0x7E,0x24,0x42 28}; 29 30//alien 3 31PROGMEM const unsigned char a3a[] = { 328, 8, //pictureresolution 33 0x18,0x3C,0x7E,0x5A,0x7E,0x24,0x42,0x24 34}; 35 36//alien 3 37PROGMEM const unsigned char a3b[] = { 388, 8, //pictureresolution 39 0x18,0x3C,0x7E,0x5A,0x7E,0x24,0x5A,0xA5 40}; 41 42//mother ship 43PROGMEM const unsigned char shp[] = { 4416, 8, //pictureresolution 45 0x07,0xE0,0x1F,0xF8,0x3F,0xFC,0x6D,0xB6,0xFF,0xFF,0x73,0xCE,0x20,0x04,0x00,0x00 46}; 47 48//cannon 1 life left 49PROGMEM const unsigned char ca1[] = { 50 16, 8, //pictureresolution 51 0x01,0x80,0x03,0xC0,0x03,0xC0,0x3F,0x7C,0x7E,0x7E,0x7F,0x7E,0x7F,0x7E,0x7E,0x3E 52}; 53 54//cannon 2 lives left 55PROGMEM const unsigned char ca2[] = { 56 16, 8, //pictureresolution 57 0x01,0x80,0x03,0xC0,0x03,0xC0,0x3E,0x7C,0x7F,0xBE,0x7F,0x7E,0x7E,0xFE,0x7E,0x3E 58}; 59 60//cannon 3 lives left 61PROGMEM const unsigned char ca3[] = { 62 16, 8, //pictureresolution 63 0x01,0x80,0x03,0xC0,0x03,0xC0,0x3E,0x7C,0x7F,0xBE,0x7F,0x7E,0x7F,0xBE,0x7E,0x7E 64}; 65 66 67//cannon 1 life left - narrow 68PROGMEM const unsigned char cn1[] = { 69 16, 8, //pictureresolution 70 0x01,0x80, 71 0x03,0xC0, 72 0x03,0xC0, 73 0x0F,0x70, 74 0x1E,0x78, 75 0x1F,0x78, 76 0x1F,0x78, 77 0x1E,0x38 78}; 79 80 81//cannon 2 lives left - narrow 82PROGMEM const unsigned char cn2[] = { 83 16, 8, //pictureresolution 84 0x01,0x80, 85 0x03,0xC0, 86 0x03,0xC0, 87 0x0E,0x70, 88 0x1F,0xB8, 89 0x1F,0x78, 90 0x1E,0xF8, 91 0x1E,0x38 92}; 93 94 95//cannon 3 lives left - narrow 96PROGMEM const unsigned char cn3[] = { 97 16, 8, //pictureresolution 98 0x01,0x80, 99 0x03,0xC0, 100 0x03,0xC0, 101 0x0E,0x70, 102 0x1F,0xB8, 103 0x1F,0x78, 104 0x1F,0xB8, 105 0x1E,0x78 106}; 107 108 109//delete cannon 110PROGMEM const unsigned char cnn[] = { 111 16, 8, //pictureresolution 112 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 113}; 114 115//cannon hit 116PROGMEM const unsigned char hit[] = { 117 16, 8, //pictureresolution 118 0x89,0x51,0x62,0x86,0x18,0x99,0xA3,0x44,0x5C,0x3A,0xB3,0x4C,0xCD,0xF3,0x37,0x5C 119}; 120 121//shield 122PROGMEM const unsigned char shd[] = { 123 32, 8, //pictureresolution 124 0x00,0x1F,0xF8,0x00,0x00,0xFF,0xFF,0x00,0x01,0xFF,0xFF,0x80,0x01,0xFF,0xFF,0x80, 125 0x01,0xFF,0xFF,0x80,0x01,0xFF,0xFF,0x80,0x01,0xF8,0x1F,0x80,0x01,0xC0,0x03,0x80 126}; 127 128 129//start 130PROGMEM const unsigned char start[] = { 131 128, 64, //pictureresolution 132 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 133 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 134 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 135 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 136 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 137 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 138 0x00,0x00,0x00,0x00,0x00,0x00,0x3C,0x00,0x00,0x3C,0x00,0x00,0x00,0x00,0x00,0x00, 139 0x00,0x00,0x00,0x00,0x00,0x00,0x3C,0x00,0x00,0x3C,0x00,0x00,0x00,0x00,0x00,0x00, 140 0x00,0x00,0x00,0x00,0x00,0x00,0x3C,0x00,0x00,0x3C,0x00,0x00,0x00,0x00,0x00,0x00, 141 0x00,0x00,0x00,0x00,0x00,0x00,0x3C,0x00,0x00,0x3C,0x00,0x00,0x00,0x00,0x00,0x00, 142 0x00,0x00,0x00,0x00,0x00,0x00,0x03,0xC0,0x03,0xC0,0x00,0x00,0x00,0x00,0x00,0x00, 143 0x00,0x00,0x00,0x00,0x00,0x00,0x03,0xC0,0x03,0xC0,0x00,0x00,0x00,0x00,0x00,0x00, 144 0x00,0x00,0x00,0x00,0x00,0x00,0x03,0xC0,0x03,0xC0,0x00,0x00,0x00,0x00,0x00,0x00, 145 0x00,0x00,0x00,0x00,0x00,0x00,0x03,0xC0,0x03,0xC0,0x00,0x00,0x00,0x00,0x00,0x00, 146 0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0xFF,0xFF,0xFC,0x00,0x00,0x00,0x00,0x00,0x00, 147 0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0xFF,0xFF,0xFC,0x00,0x00,0x00,0x00,0x00,0x00, 148 0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0xFF,0xFF,0xFC,0x00,0x00,0x00,0x00,0x00,0x00, 149 0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0xFF,0xFF,0xFC,0x00,0x00,0x00,0x00,0x00,0x00, 150 0x00,0x00,0x00,0x00,0x00,0x03,0xFC,0x3F,0xFC,0x3F,0xC0,0x00,0x00,0x00,0x00,0x00, 151 0x00,0x00,0x00,0x00,0x00,0x03,0xFC,0x3F,0xFC,0x3F,0xC0,0x00,0x00,0x00,0x00,0x00, 152 0x00,0x00,0x00,0x00,0x00,0x03,0xFC,0x3F,0xFC,0x3F,0xC0,0x00,0x00,0x00,0x00,0x00, 153 0x00,0x00,0x00,0x00,0x00,0x03,0xFC,0x3F,0xFC,0x3F,0xC0,0x00,0x00,0x00,0x00,0x00, 154 0x00,0x00,0x00,0x00,0x00,0x3F,0xFF,0xFF,0xFF,0xFF,0xFC,0x00,0x00,0x00,0x00,0x00, 155 0x00,0x00,0x00,0x00,0x00,0x3F,0xFF,0xFF,0xFF,0xFF,0xFC,0x00,0x00,0x00,0x00,0x00, 156 0x00,0x00,0x00,0x00,0x00,0x3F,0xFF,0xFF,0xFF,0xFF,0xFC,0x00,0x00,0x00,0x00,0x00, 157 0x00,0x00,0x00,0x00,0x00,0x3F,0xFF,0xFF,0xFF,0xFF,0xFC,0x00,0x00,0x00,0x00,0x00, 158 0x00,0x00,0x00,0x00,0x00,0x3C,0x3F,0xFF,0xFF,0xFC,0x3C,0x00,0x00,0x00,0x00,0x00, 159 0x00,0x00,0x00,0x00,0x00,0x3C,0x3F,0xFF,0xFF,0xFC,0x3C,0x00,0x00,0x00,0x00,0x00, 160 0x00,0x00,0x00,0x00,0x00,0x3C,0x3F,0xFF,0xFF,0xFC,0x3C,0x00,0x00,0x00,0x00,0x00, 161 0x00,0x00,0x00,0x00,0x00,0x3C,0x3F,0xFF,0xFF,0xFC,0x3C,0x00,0x00,0x00,0x00,0x00, 162 0x00,0x00,0x00,0x00,0x00,0x3C,0x3C,0x00,0x00,0x3C,0x3C,0x00,0x00,0x00,0x00,0x00, 163 0x00,0x00,0x00,0x00,0x00,0x3C,0x3C,0x00,0x00,0x3C,0x3C,0x00,0x00,0x00,0x00,0x00, 164 0x00,0x00,0x00,0x00,0x00,0x3C,0x3C,0x00,0x00,0x3C,0x3C,0x00,0x00,0x00,0x00,0x00, 165 0x00,0x00,0x00,0x00,0x00,0x3C,0x3C,0x00,0x00,0x3C,0x3C,0x00,0x00,0x00,0x00,0x00, 166 0x00,0x00,0x00,0x00,0x00,0x00,0x03,0xFC,0x3F,0xC0,0x00,0x00,0x00,0x00,0x00,0x00, 167 0x00,0x00,0x00,0x00,0x00,0x00,0x03,0xFC,0x3F,0xC0,0x00,0x00,0x00,0x00,0x00,0x00, 168 0x00,0x00,0x00,0x00,0x00,0x00,0x03,0xFC,0x3F,0xC0,0x00,0x00,0x00,0x00,0x00,0x00, 169 0x00,0x00,0x00,0x00,0x00,0x00,0x03,0xFC,0x3F,0xC0,0x00,0x00,0x00,0x00,0x00,0x00, 170 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 171 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 172 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 173 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 174 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 175 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 176 0x00,0x00,0x00,0x00,0xF3,0xCF,0x9C,0x70,0x07,0x3E,0x73,0xCF,0x80,0x00,0x00,0x00, 177 0x00,0x00,0x00,0x00,0x8A,0x28,0x22,0x88,0x08,0x88,0x8A,0x22,0x00,0x00,0x00,0x00, 178 0x00,0x00,0x00,0x00,0x8A,0x28,0x20,0x80,0x08,0x08,0x8A,0x22,0x00,0x00,0x00,0x00, 179 0x00,0x00,0x00,0x00,0xF3,0xCF,0x1C,0x70,0x07,0x08,0x8B,0xC2,0x00,0x00,0x00,0x00, 180 0x00,0x00,0x00,0x00,0x82,0x48,0x02,0x08,0x00,0x88,0xFA,0x42,0x00,0x00,0x00,0x00, 181 0x00,0x00,0x00,0x00,0x82,0x28,0x22,0x88,0x08,0x88,0x8A,0x22,0x00,0x00,0x00,0x00, 182 0x00,0x00,0x00,0x00,0x82,0x2F,0x9C,0x70,0x07,0x08,0x8A,0x22,0x00,0x00,0x00,0x00, 183 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 184 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 185 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 186 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 187 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 188 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 189 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 190 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 191 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 192 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 193 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 194 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 195 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 196}; 197 198//game over 199PROGMEM const unsigned char over[] = { 200 128, 64, //pictureresolution 201 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 202 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 203 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 204 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 205 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 206 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 207 0x00,0x00,0x00,0x00,0x00,0x00,0x3C,0x00,0x00,0x3C,0x00,0x00,0x00,0x00,0x00,0x00, 208 0x00,0x00,0x00,0x00,0x00,0x00,0x3C,0x00,0x00,0x3C,0x00,0x00,0x00,0x00,0x00,0x00, 209 0x00,0x00,0x00,0x00,0x00,0x00,0x3C,0x00,0x00,0x3C,0x00,0x00,0x00,0x00,0x00,0x00, 210 0x00,0x00,0x00,0x00,0x00,0x00,0x3C,0x00,0x00,0x3C,0x00,0x00,0x00,0x00,0x00,0x00, 211 0x00,0x00,0x00,0x00,0x00,0x00,0x03,0xC0,0x03,0xC0,0x00,0x00,0x00,0x00,0x00,0x00, 212 0x00,0x00,0x00,0x00,0x00,0x00,0x03,0xC0,0x03,0xC0,0x00,0x00,0x00,0x00,0x00,0x00, 213 0x00,0x00,0x00,0x00,0x00,0x00,0x03,0xC0,0x03,0xC0,0x00,0x00,0x00,0x00,0x00,0x00, 214 0x00,0x00,0x00,0x00,0x00,0x00,0x03,0xC0,0x03,0xC0,0x00,0x00,0x00,0x00,0x00,0x00, 215 0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0xFF,0xFF,0xFC,0x00,0x00,0x00,0x00,0x00,0x00, 216 0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0xFF,0xFF,0xFC,0x00,0x00,0x00,0x00,0x00,0x00, 217 0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0xFF,0xFF,0xFC,0x00,0x00,0x00,0x00,0x00,0x00, 218 0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0xFF,0xFF,0xFC,0x00,0x00,0x00,0x00,0x00,0x00, 219 0x00,0x00,0x00,0x00,0x00,0x03,0xFC,0x3F,0xFC,0x3F,0xC0,0x00,0x00,0x00,0x00,0x00, 220 0x00,0x00,0x00,0x00,0x00,0x03,0xFC,0x3F,0xFC,0x3F,0xC0,0x00,0x00,0x00,0x00,0x00, 221 0x00,0x00,0x00,0x00,0x00,0x03,0xFC,0x3F,0xFC,0x3F,0xC0,0x00,0x00,0x00,0x00,0x00, 222 0x00,0x00,0x00,0x00,0x00,0x03,0xFC,0x3F,0xFC,0x3F,0xC0,0x00,0x00,0x00,0x00,0x00, 223 0x00,0x00,0x00,0x00,0x00,0x3F,0xFF,0xFF,0xFF,0xFF,0xFC,0x00,0x00,0x00,0x00,0x00, 224 0x00,0x00,0x00,0x00,0x00,0x3F,0xFF,0xFF,0xFF,0xFF,0xFC,0x00,0x00,0x00,0x00,0x00, 225 0x00,0x00,0x00,0x00,0x00,0x3F,0xFF,0xFF,0xFF,0xFF,0xFC,0x00,0x00,0x00,0x00,0x00, 226 0x00,0x00,0x00,0x00,0x00,0x3F,0xFF,0xFF,0xFF,0xFF,0xFC,0x00,0x00,0x00,0x00,0x00, 227 0x00,0x00,0x00,0x00,0x00,0x3C,0x3F,0xFF,0xFF,0xFC,0x3C,0x00,0x00,0x00,0x00,0x00, 228 0x00,0x00,0x00,0x00,0x00,0x3C,0x3F,0xFF,0xFF,0xFC,0x3C,0x00,0x00,0x00,0x00,0x00, 229 0x00,0x00,0x00,0x00,0x00,0x3C,0x3F,0xFF,0xFF,0xFC,0x3C,0x00,0x00,0x00,0x00,0x00, 230 0x00,0x00,0x00,0x00,0x00,0x3C,0x3F,0xFF,0xFF,0xFC,0x3C,0x00,0x00,0x00,0x00,0x00, 231 0x00,0x00,0x00,0x00,0x00,0x3C,0x3C,0x00,0x00,0x3C,0x3C,0x00,0x00,0x00,0x00,0x00, 232 0x00,0x00,0x00,0x00,0x00,0x3C,0x3C,0x00,0x00,0x3C,0x3C,0x00,0x00,0x00,0x00,0x00, 233 0x00,0x00,0x00,0x00,0x00,0x3C,0x3C,0x00,0x00,0x3C,0x3C,0x00,0x00,0x00,0x00,0x00, 234 0x00,0x00,0x00,0x00,0x00,0x3C,0x3C,0x00,0x00,0x3C,0x3C,0x00,0x00,0x00,0x00,0x00, 235 0x00,0x00,0x00,0x00,0x00,0x00,0x03,0xFC,0x3F,0xC0,0x00,0x00,0x00,0x00,0x00,0x00, 236 0x00,0x00,0x00,0x00,0x00,0x00,0x03,0xFC,0x3F,0xC0,0x00,0x00,0x00,0x00,0x00,0x00, 237 0x00,0x00,0x00,0x00,0x00,0x00,0x03,0xFC,0x3F,0xC0,0x00,0x00,0x00,0x00,0x00,0x00, 238 0x00,0x00,0x00,0x00,0x00,0x00,0x03,0xFC,0x3F,0xC0,0x00,0x00,0x00,0x00,0x00,0x00, 239 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 240 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 241 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 242 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 243 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 244 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 245 0x00,0x00,0x00,0x00,0x03,0x8E,0x45,0xF0,0x0E,0x45,0xF7,0x80,0x00,0x00,0x00,0x00, 246 0x00,0x00,0x00,0x00,0x04,0x51,0x6D,0x00,0x11,0x45,0x04,0x40,0x00,0x00,0x00,0x00, 247 0x00,0x00,0x00,0x00,0x04,0x11,0x55,0x00,0x11,0x45,0x04,0x40,0x00,0x00,0x00,0x00, 248 0x00,0x00,0x00,0x00,0x05,0xD1,0x45,0xE0,0x11,0x45,0xE7,0x80,0x00,0x00,0x00,0x00, 249 0x00,0x00,0x00,0x00,0x04,0x5F,0x45,0x00,0x11,0x45,0x04,0x80,0x00,0x00,0x00,0x00, 250 0x00,0x00,0x00,0x00,0x04,0x51,0x45,0x00,0x11,0x29,0x04,0x40,0x00,0x00,0x00,0x00, 251 0x00,0x00,0x00,0x00,0x03,0xD1,0x45,0xF0,0x0E,0x11,0xF4,0x40,0x00,0x00,0x00,0x00, 252 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 253 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 254 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 255 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 256 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 257 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 258 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 259 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 260 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 261 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 262 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 263 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 264 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 265}; 266 267//logo 268PROGMEM const unsigned char logo[] = { 269 128, 32, //pictureresolution 270 271 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 272 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 273 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 274 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 275 0x00,0x00,0x00,0x00,0x7F,0x87,0xFE,0x0F,0xE0,0x1F,0xC1,0xFF,0x80,0x00,0x00,0x00, 276 0x00,0x00,0x00,0x00,0xFF,0xC7,0xFF,0x0F,0xF0,0x7F,0xE3,0xFF,0x80,0x00,0x00,0x00, 277 0x00,0x00,0x00,0x00,0xFF,0xF3,0xFF,0x8F,0xF0,0xFB,0xF3,0xFF,0x00,0x00,0x00,0x00, 278 0x00,0x00,0x00,0x00,0xF9,0xF3,0xEF,0x8F,0xF0,0xFB,0xF7,0xC0,0x00,0x00,0x00,0x00, 279 0x00,0x00,0x00,0x00,0x7C,0xF3,0xE7,0xCE,0xF0,0xF3,0xE7,0xC0,0x00,0x00,0x00,0x00, 280 0x00,0x00,0x00,0x00,0x7E,0x01,0xE7,0xCE,0xF1,0xF0,0x07,0xF8,0x00,0x00,0x00,0x00, 281 0x00,0x00,0x00,0x00,0x1F,0xF1,0xF7,0xDE,0x71,0xF0,0x0F,0xF8,0x00,0x00,0x00,0x00, 282 0x00,0x00,0x00,0x00,0x0F,0xF9,0xFF,0x9E,0x71,0xF0,0x0F,0x80,0x00,0x00,0x00,0x00, 283 0x00,0x00,0x00,0x00,0x00,0x7C,0xFF,0x1F,0xF9,0xE7,0xDF,0x00,0x00,0x00,0x00,0x00, 284 0x00,0x00,0x00,0x00,0x0F,0x3C,0xF0,0x1F,0xF9,0xE7,0x9E,0x00,0x00,0x00,0x00,0x00, 285 0x00,0x00,0x00,0x00,0x0F,0xFC,0xF0,0x1E,0x79,0xFF,0x9F,0xE0,0x00,0x00,0x00,0x00, 286 0x00,0x00,0x00,0x00,0x03,0xF8,0x70,0x1C,0x78,0xFE,0x3F,0xE0,0x00,0x00,0x00,0x00, 287 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 288 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 289 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 290 0x00,0x03,0xE7,0x8F,0xBE,0x3E,0x3F,0xC3,0xFF,0x8F,0xFC,0xFF,0xE1,0xFF,0x80,0x00, 291 0x00,0x00,0xF3,0xE7,0x9F,0x1F,0x3F,0xC3,0xC7,0xCF,0x00,0xF3,0xE7,0xCF,0x00,0x00, 292 0x00,0x00,0x79,0xF3,0xCF,0x9F,0x1F,0xE3,0xC7,0x9F,0x01,0xF3,0xCF,0x9E,0x00,0x00, 293 0x00,0x00,0x3C,0xFF,0xE7,0x9F,0x1F,0xE3,0xCF,0x9F,0x01,0xE7,0xDF,0x00,0x00,0x00, 294 0x00,0x00,0x1E,0x7F,0xE3,0xCF,0x1E,0xF3,0xCF,0x9F,0xF3,0xFE,0x1F,0xE0,0x00,0x00, 295 0x00,0x00,0x0F,0x3F,0xF1,0xEF,0x1E,0xF3,0xCF,0xBE,0x07,0xFE,0x0F,0xF0,0x00,0x00, 296 0x00,0x00,0x07,0x9E,0xF8,0xFF,0x1F,0xF3,0xCF,0x3C,0x07,0x9E,0x01,0xC0,0x00,0x00, 297 0x00,0x00,0x03,0xCF,0x3C,0x7F,0x1E,0xF3,0xCF,0x3C,0x0F,0x3C,0xF7,0x80,0x00,0x00, 298 0x00,0x00,0x01,0xE7,0x9C,0x3F,0x1E,0x7B,0xFE,0x3F,0xCE,0x38,0xFE,0x00,0x00,0x00, 299 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 300 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 301 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 302 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 303}; 304
TVinvaders.ino
arduino
Open with Arduino IDE, compile and upload.
1/************************************************************************** 2 * 3 * ARDUINO SPACE INVADERS 1.2 4 * 5 * Jan/2022 Giovanni Verrua 6 * 7 * This program is free software: you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License as published by 9 * the Free Software Foundation, either version 3 of the License, or 10 * (at your option) any later version. 11 * 12 * This program is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 * 17 * You should have received a copy of the GNU General Public License 18 * along with this program. If not, see <https://www.gnu.org/licenses/>. 19 * 20 * Connections to Arduino Uno/Nano: 21 * 22 * Connect a button to pin 12 (digital) and +5V (button Fire / Start) 23 * Connect a 100 kohm resistor between pin 12 (digital) and GND 24 * 25 * If you want to use a Wheel, connect a 100 k ohm potentiomenter to: 26 * GND (left pin), +5V (right pin), A0 (middle pin) 27 * 28 * If you wan to use two buttons for left and right (like the original arcade) 29 * Connect two buttons to pin 4 and +5V (but.left), and pin 5 and +5V (but.right) 30 * Connect two 100 kohm resistors between pin 5 and GND, and pin 6 and GND* 31 * 32 * TV composite out: 33 * Connect 1k ohm resistor from pin 9 to TV out (+) 34 * Connect 470 ohm resistor from pin 7 to TV out (+) 35 * Connect GND to TV out (-) 36 * 37 * Audio: 38 * Connect a speaker between pin 11 and GND 39 * 40 * Release history 41 * 42 * 1.2 - added audio effects 43 * - added an option for using buttons or potentiometer 44 * to control the cannon (see: #define USE_WHEEL) 45 * - emproved the size of the cannon (you can go back to the 46 * old size changing cn1, cn2, cn3 with ca1, ca2, ca3 47 * (look in the cannon section below) 48 * 49 * 1.1 fixed some bugs 50 * 1.0 initial release 51 * 52 **************************************************************************/ 53 54#include <TVout.h> 55#include "bitmap.h" 56#include <fontALL.h> 57 58//---------------------------------------------------------------------------------- 59 60//#define USE_WHEEL activate this if you want to use potentiometer instead of buttons 61 62#define CANNON_SPEED 20 //higher value, slower cannon - only for button control 63#define BUTTON_LEFT 4 64#define BUTTON_RIGHT 5 65#define BUTTON_FIRE 12 66 67#define WHEEL_MOVE A0 //Analog A0 - potentiometer 68#define RATIO_WHEEL 8.2 //Ratio Video X resolution Vs. potentiometer resolution 69 70//---------------------------------------------------------------------------------- 71 72#define CAN_Y_POS 86 //Cannon Y Position 73#define SHD_Y_POS 70 //Shield Y Position 74 75#define ASHIP_SPEED 50 //higher value, slower ship (must to be >0) 76#define ALIEN_SPEED 20 //higher value, slower aliens (must to be >0) 77 78TVout TV; 79 80int gamSt = 0; //0 = menu, 1 = in game, 2 = game over 81 82 83//int canMove = 0; //cannon move (wheel value) 84//int canShot = 0; //cannon shot (button pressed) 85 86int canPosX = 0; //cannon position 87int canOldX = 0; //cannon old position 88int canFire = 0; //cannon fire 1 = bullet flying, 0 = idle 89 90int canFirX = 0; //bullet X position 91int canFirY = 0; //bullet Y position 92 93//int lives = 3; 94int aSound = 0; 95int gLevel = 0; 96 97int begiY = 0; //Y begin 98int shftY = 1; //Y movement 99int shftX = 0; //X movement 100int direX = 1; //X direction (1 ; -1) 101int corrZ = 0; 102int coluR = 8; //rightmost column with at least 1 alien 103int rwLow = 4; //last lower row with at least 1 alien 104int alien = 5*9; //aliens still alive 105int aliFire = -1; //alien fire 1 = bomb falling, 0 = idle 106int aliFirX = 0; //bomb X position 107int aliFirY = 0; //bomb Y position 108 109int aMatrix[5][9] = { {0,0,0,0,0,0,0,0,0}, 110 {0,0,0,0,0,0,0,0,0}, 111 {0,0,0,0,0,0,0,0,0}, 112 {0,0,0,0,0,0,0,0,0}, 113 {0,0,0,0,0,0,0,0,0} }; 114 115 116//===================================================================================== SETUP 117void setup() { 118 119 120 //Serial.begin(9600); 121 TV.begin(_PAL); //128x96 default 122 123#ifdef USE_WHEEL 124 pinMode(WHEEL_MOVE,INPUT); 125#else 126 pinMode(BUTTON_LEFT,INPUT); 127 pinMode(BUTTON_RIGHT,INPUT); 128#endif 129 130 pinMode(BUTTON_FIRE,INPUT); 131 canFire = 0; 132 canOldX = -2; 133 gamSt = 0; 134 135} 136 137 138//===================================================================================== AlienReset 139void AlienReset() { 140 141 for (int i=0;i<5;i++){ 142 for (int j=0;j<9;j++){ 143 144 aMatrix[i][j] = 1; 145 } 146 } 147 148 begiY = gLevel*2; //Y begin - every level 2 pixels lower 149 shftY = 1; //Y movement 150 shftX = 0; //X movement 151 direX = 1; //X direction (1 ; -1) 152 corrZ = 0; 153 coluR = 8; //rightmost column with at least 1 alien 154 rwLow = 4; //last lower row with at least 1 alien 155 alien = 5*9; //aliens still alive 156 aliFire = -1; 157} 158 159 160//============================================================================= AlienCheck 161void AlienCheck() { 162 163 alien = 0; 164 for (int i=0;i<5;i++){ 165 for (int j=0;j<9;j++){ 166 if (aMatrix[i][j] == 1) alien ++; //how many aliens still alive 167 } 168 } 169 170 171 if (alien >0){ //checking what are the leftmost and rightmost columns with at least 1 alien alive 172 173 //shift all the columns leftward if the leftmost column is all empty 174 // if (shftX == 0 && direX == -1) {//solo quando sto tornando, cos evito di fare degli scatti bruschi 175 176 if (aMatrix[0][0] == 0 && aMatrix[1][0] == 0 && aMatrix[2][0] == 0 && aMatrix[3][0] == 0 && aMatrix[4][0] == 0){ 177 for (int i=0;i<5;i++){ 178 for (int j=0;j<8;j++){ 179 aMatrix[i][j] = aMatrix[i][j+1] ; 180 } 181 } 182 183 for (int i=0;i<5;i++){ 184 aMatrix[i][8] = 0; 185 } 186 } 187 // } 188 189 //check if the rightmost column (that at last check had at least 1 alien) is now empty 190 if (aMatrix[0][coluR] == 0 && aMatrix[1][coluR] == 0 && aMatrix[2][coluR] == 0 && aMatrix[3][coluR] == 0 && aMatrix[4][coluR] == 0) coluR -- ; 191 192 //check if the lowest row (that at lat check had at least 1 alien) is now empty 193 if (aMatrix[rwLow][0] == 0 && aMatrix[rwLow][1] == 0 && aMatrix[rwLow][2] == 0 && aMatrix[rwLow][3] == 0 && aMatrix[rwLow][4] == 0 && 194 aMatrix[rwLow][5] == 0 && aMatrix[rwLow][6] == 0 && aMatrix[rwLow][7] == 0 && aMatrix[rwLow][8] == 0) rwLow -- ; 195 196 } 197 198} 199 200//============================================================================= AlienDraw() 201void alienDraw() { 202 203 204 TV.draw_rect( 0, 00+begiY+shftY-corrZ, 127, (10*rwLow)+9, 0, 0 ); //deleting the old aliens position 205 for (int j=0;j<=coluR;j++){ //drawing the columns, considering the left/rightmost columns with at least 1 alien alive 206 207 if( shftX % 2 == 0){ 208 if (aMatrix[0][j] == 1) TV.bitmap((j)*10+(shftX*2), begiY+00+shftY, a3a); 209 if (aMatrix[1][j] == 1) TV.bitmap((j)*10+(shftX*2), begiY+10+shftY, a2a); 210 if (aMatrix[2][j] == 1) TV.bitmap((j)*10+(shftX*2), begiY+20+shftY, a2a); 211 if (aMatrix[3][j] == 1) TV.bitmap((j)*10+(shftX*2), begiY+30+shftY, a1a); 212 if (aMatrix[4][j] == 1) TV.bitmap((j)*10+(shftX*2), begiY+40+shftY, a1a); 213 } 214 else { 215 if (aMatrix[0][j] == 1) TV.bitmap((j)*10+(shftX*2), begiY+00+shftY, a3b); 216 if (aMatrix[1][j] == 1) TV.bitmap((j)*10+(shftX*2), begiY+10+shftY, a2b); 217 if (aMatrix[2][j] == 1) TV.bitmap((j)*10+(shftX*2), begiY+20+shftY, a2b); 218 if (aMatrix[3][j] == 1) TV.bitmap((j)*10+(shftX*2), begiY+30+shftY, a1b); 219 if (aMatrix[4][j] == 1) TV.bitmap((j)*10+(shftX*2), begiY+40+shftY, a1b); 220 } 221 } 222 223 aSound++; 224 if (aSound >3) aSound = 0; 225 TV.tone(100 - aSound*22,50); 226 //TV.delay_frame(3); NOOOO!!!!!!!!!! This will compromise the game speed, don't activate! 227} 228 229 230//============================================================================= AlienMove 231void AlienMove() { 232 233 shftX += direX; 234 235 corrZ = 0; 236 if (begiY+shftY >=2) corrZ = 2; 237 238 if ( (shftX<= 20 + (8-coluR)*5 && direX == 1) || (shftX>=0 && direX == -1) ){ //checking the horizontal movement of the aliens, considering the left/rightmost columns with at least 1 alien alive 239 240 alienDraw() ; 241 } 242 else { 243 244 shftY = shftY + 2; 245 direX = direX *-1; 246 shftX += direX; //don't remove! 247 248 alienDraw() ; 249 } 250 251} 252 253 254//============================================================================= AlienHit 255void alienHit() { 256 257 for (int j=0;j<=coluR;j++){ //drawing the columns, considering the left/rightmost columns with at least 1 alien alive 258 for (int i=0;i<=4;i++){ //drawing the columns, considering the left/rightmost columns with at least 1 alien alive 259 if (canFirX >=(j)*10+(shftX*2) && canFirX <=(j)*10+(shftX*2)+8 && canFirY >= begiY+ i*10 +shftY && canFirY <= begiY+ i*10 +shftY+8) { 260 aMatrix[i][j] = 0; 261 j = coluR+1; 262 i = 5; 263 canFire = -1; 264 TV.tone(2000,50); 265 TV.delay_frame(1); 266 } 267 } 268 } 269 270 alienDraw() ; 271 272} 273 274 275//===================================================================================== LOOP 276void loop() { 277 278 unsigned long miab = millis() ; //delay - alien bomb 279 unsigned long micb = millis() ; //delay - cannon bullet 280 unsigned long mill = millis() ; //delay - aliens 281 unsigned long mish = millis() ; //delay - ship 282 283#ifndef USE_WHEEL 284 unsigned long cand = millis() ; //cannon delay 285#endif 286 287 int canMove = 0; 288 int Score = 0; 289 int lives = 3; 290 int shpMove = 0; 291 int shpPosX = 0; 292 293 //-----------------------------------------------------------------------------------------------------MENU 294 if (gamSt == 0){ //MENU 295 296 TV.clear_screen(); 297 TV.bitmap(0, 0, logo); 298 TV.bitmap(0, 32, start); 299 300 delay(500); 301 302 while ( digitalRead(BUTTON_FIRE) == 0){ 303 //canShot = digitalRead(BUTTON_FIRE); //cannon shot 304 } 305 306 gamSt = 1; 307 delay(300); 308 } 309 310 311 //-----------------------------------------------------------------------------------------------------IN GAME 312 313 if (gamSt == 1){ // IN GAME 314 315 Score = 0; 316 lives = 3; 317 canOldX = -2; 318 aSound = 3; 319 gLevel = 0; 320 321 TV.clear_screen(); 322 TV.bitmap(10,SHD_Y_POS,shd); 323 TV.bitmap(35,SHD_Y_POS,shd); 324 TV.bitmap(60,SHD_Y_POS,shd); 325 TV.bitmap(85,SHD_Y_POS,shd); 326 AlienReset(); 327 AlienCheck(); 328 329 delay(50); 330 331/* shouldn't be needed.... 332#ifdef USE_WHEEL 333 canMove = analogRead(WHEEL_MOVE); //cannon move 334#endif 335 336 canShot = digitalRead(BUTTON_FIRE); //cannon shot 337*/ 338 339 shftY = 0 ; 340 //-----------------------------------------------------------------------------------------------------Main Cycle-begin-\\ 341 342 while ( (shftY/2 < 19 + (4 - rwLow)*5) && gamSt != 2 ) { //Vertical moving. 343 344 345 //-------------------------------------------------------------Cannon-begin-\ 346 347 348 349 //-----------------------------------cannon move 350 351#ifdef USE_WHEEL //------------------------------------- using potentiometer -----------------------------------------------| 352 canMove = analogRead(WHEEL_MOVE); //cannon move 353 canPosX = canMove / RATIO_WHEEL ; 354 355 if (canPosX -1 == canOldX || canPosX + 1 == canOldX) canPosX = canOldX; //Avoiding flickering 356 357#else //------------------------------------- using buttons left and right----------------------------------------| 358 359 if (cand + CANNON_SPEED < millis()) { 360 cand = millis() ; 361 if (digitalRead(BUTTON_LEFT )==1 && canPosX >0 ) canPosX-- ; 362 if (digitalRead(BUTTON_RIGHT)==1 && canPosX <110) canPosX++ ; 363 } 364#endif //-----------------------------------------------------------------------------------------------------------| 365 366 if (canOldX != canPosX) { 367 TV.bitmap(canOldX, CAN_Y_POS, cnn); 368 if (lives == 3) TV.bitmap(canPosX, CAN_Y_POS, cn3); //use ca3 instead of cn3 if you want a wider cannon 369 if (lives == 2) TV.bitmap(canPosX, CAN_Y_POS, cn2); //use ca2 instead of cn2 if you want a wider cannon 370 if (lives == 1) TV.bitmap(canPosX, CAN_Y_POS, cn1); //use ca1 instead of cn1 if you want a wider cannon 371 canOldX = canPosX; 372 } 373 374 375 //-----------------------------------cannon fire 376 377 //canShot = digitalRead(BUTTON_FIRE); //cannon shot 378 379 if (canFire == -1){ //cannon fire 1 = bullet flying, 0 = idle -1 = Hit 380 TV.draw_line(canFirX,canFirY, canFirX,canFirY+4,0); 381 canFire = 0; 382 } 383 384 385 if (canFire == 0){ //cannon fire 1 = bullet flying, 0 = idle 386 if (digitalRead(BUTTON_FIRE) == 1 && micb < millis() ) { 387 canFire = 1; 388 canFirX = canPosX+8; //bullet X position 389 canFirY = 81; //bullet Y position 390 } 391 } 392 393 if (canFire == 1){ //cannon fire 1 = bullet flying, 0 = idle 394 395 if (micb+10 < millis()){ 396 397 if (TV.get_pixel(canFirX,canFirY-1) == 1){ 398 399 if (shpMove == 1 && canFirY < 10) { 400 //hit the ship 401 TV.tone(2000,50); 402 Score += 10; 403 shpMove = 0; 404 canFire = -1; 405 TV.draw_rect(00,00,128,9,0,0); 406 TV.draw_line(canFirX,canFirY-2,canFirX,canFirY+4,0); 407 //micb = millis() + 200; //delay before next shot 408 409 } 410 else { 411 412 if (canFirY <=begiY+(10*rwLow)+9+shftY){ 413 //hit an alien 414 alienHit(); 415 Score ++; 416 //micb = millis() + 200; //delay before next shot 417 418 if ((00+begiY+shftY-corrZ) > 4 && shpMove == 0){ 419 TV.select_font(font4x6); 420 TV.print(00,00,"SCORE:"); 421 TV.print(40,00,Score); 422 } 423 424 } 425 else{ 426 //hit the shield 427 canFire = -1; 428 TV.draw_line(canFirX,canFirY-2,canFirX,canFirY+4,0); 429 //micb = millis() + 200; //delay before next shot 430 } 431 } 432 433 micb = millis() + 200; //delay before next shot 434 TV.draw_line(canFirX,canFirY,canFirX,canFirY+4,0); 435 canFire = -1; //error trap 436 } 437 else 438 { 439 canFirY --; 440 micb = millis(); 441 if (canFirY <= 0){ 442 canFire = 0; 443 TV.draw_line(canFirX,canFirY,canFirX,canFirY+4,0); 444 micb = millis() + 200; //delay before next shot 445 } 446 447 } 448 449 if (canFire == 1){ 450 TV.draw_line(canFirX,canFirY+1,canFirX,canFirY+4,0); 451 TV.draw_line(canFirX,canFirY, canFirX,canFirY+3,1); 452 } 453 } 454 455 } 456 457 if (alien == 0){ 458 gLevel++; 459 TV.clear_screen(); 460 AlienReset(); 461 TV.bitmap(10,SHD_Y_POS,shd); 462 TV.bitmap(35,SHD_Y_POS,shd); 463 TV.bitmap(60,SHD_Y_POS,shd); 464 TV.bitmap(85,SHD_Y_POS,shd); 465 canFire = 0; 466 canOldX = -2; 467 } 468 469 //-------------------------------------------------------------Cannon-end---/ 470 471 //-------------------------------------------------------------Ship begin--\\ 472 473 if ((00+begiY+shftY-corrZ) > 8 ){ //if there's enough space in the upper part of the screen 474 475 if (shpMove == 0){ 476 if (mish + 15000+random(10000,25000) < millis()){ //every 25-40 seconds 477 shpMove = 1; 478 TV.draw_rect(00,00,128,9,0,0); 479 mish = millis() - ASHIP_SPEED - 1 ; 480 shpPosX = 1; //not = 0! 481 } 482 } 483 484 if (shpMove == 1){ 485 if (mish + ASHIP_SPEED < millis()){ 486 TV.bitmap(shpPosX-1,0,cnn); 487 TV.bitmap(shpPosX,0,shp); 488 shpPosX++ ; 489 mish = millis(); 490 491 if (shpPosX >= 112){ 492 shpMove = 0; 493 TV.draw_rect(00,00,128,9,0,0); 494 } 495 } 496 } 497 498 499 } 500 501 502 //-------------------------------------------------------------Aliens-begin-\\ 503 504 if (mill + ALIEN_SPEED*alien < millis()){ 505 mill = millis(); 506 AlienCheck(); 507 AlienMove(); 508 509 if ((00+begiY+shftY-corrZ) > 4 && shpMove == 0){ 510 511 TV.select_font(font4x6); 512 TV.print(00,00,"SCORE:"); 513 TV.print(40,00,Score); 514 } 515 516 } 517 518 //-------------------------------------------------------------Aliens-end---/ 519 520 //--------------------------------------------------------Aliens bomb-begin-\\ 521 522 //---------------------------------------------------- 523 if (aliFire == -1){ // end of bomb fall 524 //TV.draw_line(aliFirX,aliFirY, aliFirX,aliFirY+4,0); 525 aliFire = 0; 526 miab = millis() + 40*alien ; 527 } 528 529 //---------------------------------------------------- 530 if (aliFire == 0){ //0 = idle - waiting for the next bomb 531 532 if (miab+10 < millis()){ //drop the bomb at the right time 533 534 aliFirY = begiY+(10*rwLow)+9+shftY; //bomb Y position 535 aliFire = 1; 536 537 //to be improved: should not drop bomb from an empty column 538 if (canPosX >=(shftX*2) && canPosX <=10*coluR+(shftX*2)){ //the cannon is below the aliens 539 aliFirX = canPosX+8+random(-4,+4); //bomb X position = center of cannon 540 } 541 542 if (canPosX < shftX*2){ //drop the bomb as closest as possible to the cannon 543 aliFirX = shftX*2; 544 } 545 546 if (canPosX > 10*coluR+(shftX*2)){ //drop the bomb as closest as possible to the cannon 547 aliFirX = 10*coluR+(shftX*2); 548 } 549 550 //check if there's at least an alien over it 551 int fndAlien = 0; 552 553 for (int i=aliFirY;i >begiY+9+shftY;i-=3){ 554 if (TV.get_pixel(aliFirX,i) == 1) fndAlien = 1; 555 } 556 557 if (fndAlien==0){ //the cannon is under an empty column, so there's no need to drop a bomb 558 aliFire = 0; 559 } 560 561 } 562 } 563 564 //---------------------------------------------------- 565 if (aliFire == 1){ //bomb dropping 566 if (miab+10 < millis()){ 567 568 TV.draw_line(aliFirX,aliFirY-1,aliFirX,aliFirY-4,0); 569 TV.draw_line(aliFirX,aliFirY,aliFirX,aliFirY-3,1); 570 571 if (TV.get_pixel(aliFirX,aliFirY+1) == 1){ 572 573 aliFire = -1; 574 TV.draw_line(aliFirX,aliFirY,aliFirX,aliFirY-3,0); 575 576 if (aliFirY+1 >=CAN_Y_POS) { 577 578 //hit the cannon. 579 for (int i=0;i<27;i++){ 580 TV.tone(70,10); 581 TV.delay_frame(1); 582 TV.bitmap(canPosX, CAN_Y_POS, hit); 583 delay(5); 584 TV.tone(40,10); 585 TV.delay_frame(1); 586 if (lives == 3) TV.bitmap(canPosX, CAN_Y_POS, cn3); //use ca3 instead of cn3 if you want a wider cannon 587 if (lives == 2) TV.bitmap(canPosX, CAN_Y_POS, cn2); //use ca2 instead of cn2 if you want a wider cannon 588 if (lives == 1) TV.bitmap(canPosX, CAN_Y_POS, cn1); //use ca1 instead of cn1 if you want a wider cannon 589 delay(5); 590 } 591 592 lives --; 593 594 delay(500); 595 596 if (lives <=0) gamSt = 2; 597 if (lives == 3) TV.bitmap(canPosX, CAN_Y_POS, cn3); //use ca3 instead of cn3 if you want a wider cannon 598 if (lives == 2) TV.bitmap(canPosX, CAN_Y_POS, cn2); //use ca2 instead of cn2 if you want a wider cannon 599 if (lives == 1) TV.bitmap(canPosX, CAN_Y_POS, cn1); //use ca1 instead of cn1 if you want a wider cannon 600 601 } 602 else { 603 //hit the shield. Just open an hole. 604 TV.draw_line(aliFirX,aliFirY+2,aliFirX,aliFirY-3,0); 605 } 606 } 607 else 608 { 609 aliFirY ++; 610 miab = millis(); 611 if (aliFirY >= 92){ 612 aliFire = -1; 613 TV.draw_line(aliFirX,aliFirY,aliFirX,aliFirY-4,0); 614 } 615 } 616 } 617 } 618 619 //--------------------------------------------------------Aliens bomb-end---/ 620 } 621 //-----------------------------------------------------------------------------------------------------Main Cycle-end--- / 622 gamSt = 2 ; 623 } 624 625 //-----------------------------------------------------------------------------------------------------GAME OVER 626 if (gamSt == 2){ //GAME OVER 627 gamSt = 0; 628 TV.clear_screen(); 629 TV.bitmap(0, 0, logo); 630 TV.bitmap(0, 32, over); 631 TV.select_font(font6x8); 632 TV.print(40,90,"SCORE:"); 633 TV.print(76,90,Score); 634 delay(1000); 635 636 //must to release and press again the button before to continue 637 while ( digitalRead(BUTTON_FIRE) == 1){ 638 //canShot = digitalRead(BUTTON_FIRE); //cannon shot 639 } 640 641 while ( digitalRead(BUTTON_FIRE) == 0){ 642 //canShot = digitalRead(BUTTON_FIRE); //cannon shot 643 } 644 645 } 646 647} 648
bitmap.h
arduino
1/** 2 * Space Invaders - aliens definition 3 * 4 */ 5 6//alien 1 7PROGMEM const unsigned char a1a[] = { 88, 8, //pictureresolution 9 0x18,0x7E,0xFF,0xDB,0xFF,0x66,0xDB,0x42 10}; 11 12//alien 1 13PROGMEM const unsigned char a1b[] = { 148, 8, //pictureresolution 15 0x18,0x7E,0xFF,0xDB,0xFF,0x24,0x5A,0x81 16}; 17 18//alien 2 19PROGMEM const unsigned char a2a[] = { 208, 8, //pictureresolution 21 0x42,0x24,0x7E,0xDB,0xFF,0xBD,0xA5,0x24 22}; 23 24//alien 2 25PROGMEM const unsigned char a2b[] = { 268, 8, //pictureresolution 27 0x42,0x24,0xBD,0xDB,0xFF,0x7E,0x24,0x42 28}; 29 30//alien 3 31PROGMEM const unsigned char a3a[] = { 328, 8, //pictureresolution 33 0x18,0x3C,0x7E,0x5A,0x7E,0x24,0x42,0x24 34}; 35 36//alien 3 37PROGMEM const unsigned char a3b[] = { 388, 8, //pictureresolution 39 0x18,0x3C,0x7E,0x5A,0x7E,0x24,0x5A,0xA5 40}; 41 42//mother ship 43PROGMEM const unsigned char shp[] = { 4416, 8, //pictureresolution 45 0x07,0xE0,0x1F,0xF8,0x3F,0xFC,0x6D,0xB6,0xFF,0xFF,0x73,0xCE,0x20,0x04,0x00,0x00 46}; 47 48//cannon 1 life left 49PROGMEM const unsigned char ca1[] = { 50 16, 8, //pictureresolution 51 0x01,0x80,0x03,0xC0,0x03,0xC0,0x3F,0x7C,0x7E,0x7E,0x7F,0x7E,0x7F,0x7E,0x7E,0x3E 52}; 53 54//cannon 2 lives left 55PROGMEM const unsigned char ca2[] = { 56 16, 8, //pictureresolution 57 0x01,0x80,0x03,0xC0,0x03,0xC0,0x3E,0x7C,0x7F,0xBE,0x7F,0x7E,0x7E,0xFE,0x7E,0x3E 58}; 59 60//cannon 3 lives left 61PROGMEM const unsigned char ca3[] = { 62 16, 8, //pictureresolution 63 0x01,0x80,0x03,0xC0,0x03,0xC0,0x3E,0x7C,0x7F,0xBE,0x7F,0x7E,0x7F,0xBE,0x7E,0x7E 64}; 65 66 67//cannon 1 life left - narrow 68PROGMEM const unsigned char cn1[] = { 69 16, 8, //pictureresolution 70 0x01,0x80, 71 0x03,0xC0, 72 0x03,0xC0, 73 0x0F,0x70, 74 0x1E,0x78, 75 0x1F,0x78, 76 0x1F,0x78, 77 0x1E,0x38 78}; 79 80 81//cannon 2 lives left - narrow 82PROGMEM const unsigned char cn2[] = { 83 16, 8, //pictureresolution 84 0x01,0x80, 85 0x03,0xC0, 86 0x03,0xC0, 87 0x0E,0x70, 88 0x1F,0xB8, 89 0x1F,0x78, 90 0x1E,0xF8, 91 0x1E,0x38 92}; 93 94 95//cannon 3 lives left - narrow 96PROGMEM const unsigned char cn3[] = { 97 16, 8, //pictureresolution 98 0x01,0x80, 99 0x03,0xC0, 100 0x03,0xC0, 101 0x0E,0x70, 102 0x1F,0xB8, 103 0x1F,0x78, 104 0x1F,0xB8, 105 0x1E,0x78 106}; 107 108 109//delete cannon 110PROGMEM const unsigned char cnn[] = { 111 16, 8, //pictureresolution 112 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 113}; 114 115//cannon hit 116PROGMEM const unsigned char hit[] = { 117 16, 8, //pictureresolution 118 0x89,0x51,0x62,0x86,0x18,0x99,0xA3,0x44,0x5C,0x3A,0xB3,0x4C,0xCD,0xF3,0x37,0x5C 119}; 120 121//shield 122PROGMEM const unsigned char shd[] = { 123 32, 8, //pictureresolution 124 0x00,0x1F,0xF8,0x00,0x00,0xFF,0xFF,0x00,0x01,0xFF,0xFF,0x80,0x01,0xFF,0xFF,0x80, 125 0x01,0xFF,0xFF,0x80,0x01,0xFF,0xFF,0x80,0x01,0xF8,0x1F,0x80,0x01,0xC0,0x03,0x80 126}; 127 128 129//start 130PROGMEM const unsigned char start[] = { 131 128, 64, //pictureresolution 132 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 133 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 134 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 135 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 136 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 137 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 138 0x00,0x00,0x00,0x00,0x00,0x00,0x3C,0x00,0x00,0x3C,0x00,0x00,0x00,0x00,0x00,0x00, 139 0x00,0x00,0x00,0x00,0x00,0x00,0x3C,0x00,0x00,0x3C,0x00,0x00,0x00,0x00,0x00,0x00, 140 0x00,0x00,0x00,0x00,0x00,0x00,0x3C,0x00,0x00,0x3C,0x00,0x00,0x00,0x00,0x00,0x00, 141 0x00,0x00,0x00,0x00,0x00,0x00,0x3C,0x00,0x00,0x3C,0x00,0x00,0x00,0x00,0x00,0x00, 142 0x00,0x00,0x00,0x00,0x00,0x00,0x03,0xC0,0x03,0xC0,0x00,0x00,0x00,0x00,0x00,0x00, 143 0x00,0x00,0x00,0x00,0x00,0x00,0x03,0xC0,0x03,0xC0,0x00,0x00,0x00,0x00,0x00,0x00, 144 0x00,0x00,0x00,0x00,0x00,0x00,0x03,0xC0,0x03,0xC0,0x00,0x00,0x00,0x00,0x00,0x00, 145 0x00,0x00,0x00,0x00,0x00,0x00,0x03,0xC0,0x03,0xC0,0x00,0x00,0x00,0x00,0x00,0x00, 146 0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0xFF,0xFF,0xFC,0x00,0x00,0x00,0x00,0x00,0x00, 147 0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0xFF,0xFF,0xFC,0x00,0x00,0x00,0x00,0x00,0x00, 148 0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0xFF,0xFF,0xFC,0x00,0x00,0x00,0x00,0x00,0x00, 149 0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0xFF,0xFF,0xFC,0x00,0x00,0x00,0x00,0x00,0x00, 150 0x00,0x00,0x00,0x00,0x00,0x03,0xFC,0x3F,0xFC,0x3F,0xC0,0x00,0x00,0x00,0x00,0x00, 151 0x00,0x00,0x00,0x00,0x00,0x03,0xFC,0x3F,0xFC,0x3F,0xC0,0x00,0x00,0x00,0x00,0x00, 152 0x00,0x00,0x00,0x00,0x00,0x03,0xFC,0x3F,0xFC,0x3F,0xC0,0x00,0x00,0x00,0x00,0x00, 153 0x00,0x00,0x00,0x00,0x00,0x03,0xFC,0x3F,0xFC,0x3F,0xC0,0x00,0x00,0x00,0x00,0x00, 154 0x00,0x00,0x00,0x00,0x00,0x3F,0xFF,0xFF,0xFF,0xFF,0xFC,0x00,0x00,0x00,0x00,0x00, 155 0x00,0x00,0x00,0x00,0x00,0x3F,0xFF,0xFF,0xFF,0xFF,0xFC,0x00,0x00,0x00,0x00,0x00, 156 0x00,0x00,0x00,0x00,0x00,0x3F,0xFF,0xFF,0xFF,0xFF,0xFC,0x00,0x00,0x00,0x00,0x00, 157 0x00,0x00,0x00,0x00,0x00,0x3F,0xFF,0xFF,0xFF,0xFF,0xFC,0x00,0x00,0x00,0x00,0x00, 158 0x00,0x00,0x00,0x00,0x00,0x3C,0x3F,0xFF,0xFF,0xFC,0x3C,0x00,0x00,0x00,0x00,0x00, 159 0x00,0x00,0x00,0x00,0x00,0x3C,0x3F,0xFF,0xFF,0xFC,0x3C,0x00,0x00,0x00,0x00,0x00, 160 0x00,0x00,0x00,0x00,0x00,0x3C,0x3F,0xFF,0xFF,0xFC,0x3C,0x00,0x00,0x00,0x00,0x00, 161 0x00,0x00,0x00,0x00,0x00,0x3C,0x3F,0xFF,0xFF,0xFC,0x3C,0x00,0x00,0x00,0x00,0x00, 162 0x00,0x00,0x00,0x00,0x00,0x3C,0x3C,0x00,0x00,0x3C,0x3C,0x00,0x00,0x00,0x00,0x00, 163 0x00,0x00,0x00,0x00,0x00,0x3C,0x3C,0x00,0x00,0x3C,0x3C,0x00,0x00,0x00,0x00,0x00, 164 0x00,0x00,0x00,0x00,0x00,0x3C,0x3C,0x00,0x00,0x3C,0x3C,0x00,0x00,0x00,0x00,0x00, 165 0x00,0x00,0x00,0x00,0x00,0x3C,0x3C,0x00,0x00,0x3C,0x3C,0x00,0x00,0x00,0x00,0x00, 166 0x00,0x00,0x00,0x00,0x00,0x00,0x03,0xFC,0x3F,0xC0,0x00,0x00,0x00,0x00,0x00,0x00, 167 0x00,0x00,0x00,0x00,0x00,0x00,0x03,0xFC,0x3F,0xC0,0x00,0x00,0x00,0x00,0x00,0x00, 168 0x00,0x00,0x00,0x00,0x00,0x00,0x03,0xFC,0x3F,0xC0,0x00,0x00,0x00,0x00,0x00,0x00, 169 0x00,0x00,0x00,0x00,0x00,0x00,0x03,0xFC,0x3F,0xC0,0x00,0x00,0x00,0x00,0x00,0x00, 170 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 171 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 172 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 173 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 174 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 175 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 176 0x00,0x00,0x00,0x00,0xF3,0xCF,0x9C,0x70,0x07,0x3E,0x73,0xCF,0x80,0x00,0x00,0x00, 177 0x00,0x00,0x00,0x00,0x8A,0x28,0x22,0x88,0x08,0x88,0x8A,0x22,0x00,0x00,0x00,0x00, 178 0x00,0x00,0x00,0x00,0x8A,0x28,0x20,0x80,0x08,0x08,0x8A,0x22,0x00,0x00,0x00,0x00, 179 0x00,0x00,0x00,0x00,0xF3,0xCF,0x1C,0x70,0x07,0x08,0x8B,0xC2,0x00,0x00,0x00,0x00, 180 0x00,0x00,0x00,0x00,0x82,0x48,0x02,0x08,0x00,0x88,0xFA,0x42,0x00,0x00,0x00,0x00, 181 0x00,0x00,0x00,0x00,0x82,0x28,0x22,0x88,0x08,0x88,0x8A,0x22,0x00,0x00,0x00,0x00, 182 0x00,0x00,0x00,0x00,0x82,0x2F,0x9C,0x70,0x07,0x08,0x8A,0x22,0x00,0x00,0x00,0x00, 183 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 184 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 185 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 186 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 187 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 188 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 189 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 190 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 191 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 192 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 193 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 194 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 195 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 196}; 197 198//game over 199PROGMEM const unsigned char over[] = { 200 128, 64, //pictureresolution 201 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 202 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 203 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 204 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 205 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 206 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 207 0x00,0x00,0x00,0x00,0x00,0x00,0x3C,0x00,0x00,0x3C,0x00,0x00,0x00,0x00,0x00,0x00, 208 0x00,0x00,0x00,0x00,0x00,0x00,0x3C,0x00,0x00,0x3C,0x00,0x00,0x00,0x00,0x00,0x00, 209 0x00,0x00,0x00,0x00,0x00,0x00,0x3C,0x00,0x00,0x3C,0x00,0x00,0x00,0x00,0x00,0x00, 210 0x00,0x00,0x00,0x00,0x00,0x00,0x3C,0x00,0x00,0x3C,0x00,0x00,0x00,0x00,0x00,0x00, 211 0x00,0x00,0x00,0x00,0x00,0x00,0x03,0xC0,0x03,0xC0,0x00,0x00,0x00,0x00,0x00,0x00, 212 0x00,0x00,0x00,0x00,0x00,0x00,0x03,0xC0,0x03,0xC0,0x00,0x00,0x00,0x00,0x00,0x00, 213 0x00,0x00,0x00,0x00,0x00,0x00,0x03,0xC0,0x03,0xC0,0x00,0x00,0x00,0x00,0x00,0x00, 214 0x00,0x00,0x00,0x00,0x00,0x00,0x03,0xC0,0x03,0xC0,0x00,0x00,0x00,0x00,0x00,0x00, 215 0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0xFF,0xFF,0xFC,0x00,0x00,0x00,0x00,0x00,0x00, 216 0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0xFF,0xFF,0xFC,0x00,0x00,0x00,0x00,0x00,0x00, 217 0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0xFF,0xFF,0xFC,0x00,0x00,0x00,0x00,0x00,0x00, 218 0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0xFF,0xFF,0xFC,0x00,0x00,0x00,0x00,0x00,0x00, 219 0x00,0x00,0x00,0x00,0x00,0x03,0xFC,0x3F,0xFC,0x3F,0xC0,0x00,0x00,0x00,0x00,0x00, 220 0x00,0x00,0x00,0x00,0x00,0x03,0xFC,0x3F,0xFC,0x3F,0xC0,0x00,0x00,0x00,0x00,0x00, 221 0x00,0x00,0x00,0x00,0x00,0x03,0xFC,0x3F,0xFC,0x3F,0xC0,0x00,0x00,0x00,0x00,0x00, 222 0x00,0x00,0x00,0x00,0x00,0x03,0xFC,0x3F,0xFC,0x3F,0xC0,0x00,0x00,0x00,0x00,0x00, 223 0x00,0x00,0x00,0x00,0x00,0x3F,0xFF,0xFF,0xFF,0xFF,0xFC,0x00,0x00,0x00,0x00,0x00, 224 0x00,0x00,0x00,0x00,0x00,0x3F,0xFF,0xFF,0xFF,0xFF,0xFC,0x00,0x00,0x00,0x00,0x00, 225 0x00,0x00,0x00,0x00,0x00,0x3F,0xFF,0xFF,0xFF,0xFF,0xFC,0x00,0x00,0x00,0x00,0x00, 226 0x00,0x00,0x00,0x00,0x00,0x3F,0xFF,0xFF,0xFF,0xFF,0xFC,0x00,0x00,0x00,0x00,0x00, 227 0x00,0x00,0x00,0x00,0x00,0x3C,0x3F,0xFF,0xFF,0xFC,0x3C,0x00,0x00,0x00,0x00,0x00, 228 0x00,0x00,0x00,0x00,0x00,0x3C,0x3F,0xFF,0xFF,0xFC,0x3C,0x00,0x00,0x00,0x00,0x00, 229 0x00,0x00,0x00,0x00,0x00,0x3C,0x3F,0xFF,0xFF,0xFC,0x3C,0x00,0x00,0x00,0x00,0x00, 230 0x00,0x00,0x00,0x00,0x00,0x3C,0x3F,0xFF,0xFF,0xFC,0x3C,0x00,0x00,0x00,0x00,0x00, 231 0x00,0x00,0x00,0x00,0x00,0x3C,0x3C,0x00,0x00,0x3C,0x3C,0x00,0x00,0x00,0x00,0x00, 232 0x00,0x00,0x00,0x00,0x00,0x3C,0x3C,0x00,0x00,0x3C,0x3C,0x00,0x00,0x00,0x00,0x00, 233 0x00,0x00,0x00,0x00,0x00,0x3C,0x3C,0x00,0x00,0x3C,0x3C,0x00,0x00,0x00,0x00,0x00, 234 0x00,0x00,0x00,0x00,0x00,0x3C,0x3C,0x00,0x00,0x3C,0x3C,0x00,0x00,0x00,0x00,0x00, 235 0x00,0x00,0x00,0x00,0x00,0x00,0x03,0xFC,0x3F,0xC0,0x00,0x00,0x00,0x00,0x00,0x00, 236 0x00,0x00,0x00,0x00,0x00,0x00,0x03,0xFC,0x3F,0xC0,0x00,0x00,0x00,0x00,0x00,0x00, 237 0x00,0x00,0x00,0x00,0x00,0x00,0x03,0xFC,0x3F,0xC0,0x00,0x00,0x00,0x00,0x00,0x00, 238 0x00,0x00,0x00,0x00,0x00,0x00,0x03,0xFC,0x3F,0xC0,0x00,0x00,0x00,0x00,0x00,0x00, 239 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 240 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 241 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 242 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 243 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 244 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 245 0x00,0x00,0x00,0x00,0x03,0x8E,0x45,0xF0,0x0E,0x45,0xF7,0x80,0x00,0x00,0x00,0x00, 246 0x00,0x00,0x00,0x00,0x04,0x51,0x6D,0x00,0x11,0x45,0x04,0x40,0x00,0x00,0x00,0x00, 247 0x00,0x00,0x00,0x00,0x04,0x11,0x55,0x00,0x11,0x45,0x04,0x40,0x00,0x00,0x00,0x00, 248 0x00,0x00,0x00,0x00,0x05,0xD1,0x45,0xE0,0x11,0x45,0xE7,0x80,0x00,0x00,0x00,0x00, 249 0x00,0x00,0x00,0x00,0x04,0x5F,0x45,0x00,0x11,0x45,0x04,0x80,0x00,0x00,0x00,0x00, 250 0x00,0x00,0x00,0x00,0x04,0x51,0x45,0x00,0x11,0x29,0x04,0x40,0x00,0x00,0x00,0x00, 251 0x00,0x00,0x00,0x00,0x03,0xD1,0x45,0xF0,0x0E,0x11,0xF4,0x40,0x00,0x00,0x00,0x00, 252 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 253 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 254 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 255 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 256 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 257 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 258 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 259 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 260 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 261 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 262 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 263 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 264 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 265}; 266 267//logo 268PROGMEM const unsigned char logo[] = { 269 128, 32, //pictureresolution 270 271 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 272 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 273 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 274 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 275 0x00,0x00,0x00,0x00,0x7F,0x87,0xFE,0x0F,0xE0,0x1F,0xC1,0xFF,0x80,0x00,0x00,0x00, 276 0x00,0x00,0x00,0x00,0xFF,0xC7,0xFF,0x0F,0xF0,0x7F,0xE3,0xFF,0x80,0x00,0x00,0x00, 277 0x00,0x00,0x00,0x00,0xFF,0xF3,0xFF,0x8F,0xF0,0xFB,0xF3,0xFF,0x00,0x00,0x00,0x00, 278 0x00,0x00,0x00,0x00,0xF9,0xF3,0xEF,0x8F,0xF0,0xFB,0xF7,0xC0,0x00,0x00,0x00,0x00, 279 0x00,0x00,0x00,0x00,0x7C,0xF3,0xE7,0xCE,0xF0,0xF3,0xE7,0xC0,0x00,0x00,0x00,0x00, 280 0x00,0x00,0x00,0x00,0x7E,0x01,0xE7,0xCE,0xF1,0xF0,0x07,0xF8,0x00,0x00,0x00,0x00, 281 0x00,0x00,0x00,0x00,0x1F,0xF1,0xF7,0xDE,0x71,0xF0,0x0F,0xF8,0x00,0x00,0x00,0x00, 282 0x00,0x00,0x00,0x00,0x0F,0xF9,0xFF,0x9E,0x71,0xF0,0x0F,0x80,0x00,0x00,0x00,0x00, 283 0x00,0x00,0x00,0x00,0x00,0x7C,0xFF,0x1F,0xF9,0xE7,0xDF,0x00,0x00,0x00,0x00,0x00, 284 0x00,0x00,0x00,0x00,0x0F,0x3C,0xF0,0x1F,0xF9,0xE7,0x9E,0x00,0x00,0x00,0x00,0x00, 285 0x00,0x00,0x00,0x00,0x0F,0xFC,0xF0,0x1E,0x79,0xFF,0x9F,0xE0,0x00,0x00,0x00,0x00, 286 0x00,0x00,0x00,0x00,0x03,0xF8,0x70,0x1C,0x78,0xFE,0x3F,0xE0,0x00,0x00,0x00,0x00, 287 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 288 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 289 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 290 0x00,0x03,0xE7,0x8F,0xBE,0x3E,0x3F,0xC3,0xFF,0x8F,0xFC,0xFF,0xE1,0xFF,0x80,0x00, 291 0x00,0x00,0xF3,0xE7,0x9F,0x1F,0x3F,0xC3,0xC7,0xCF,0x00,0xF3,0xE7,0xCF,0x00,0x00, 292 0x00,0x00,0x79,0xF3,0xCF,0x9F,0x1F,0xE3,0xC7,0x9F,0x01,0xF3,0xCF,0x9E,0x00,0x00, 293 0x00,0x00,0x3C,0xFF,0xE7,0x9F,0x1F,0xE3,0xCF,0x9F,0x01,0xE7,0xDF,0x00,0x00,0x00, 294 0x00,0x00,0x1E,0x7F,0xE3,0xCF,0x1E,0xF3,0xCF,0x9F,0xF3,0xFE,0x1F,0xE0,0x00,0x00, 295 0x00,0x00,0x0F,0x3F,0xF1,0xEF,0x1E,0xF3,0xCF,0xBE,0x07,0xFE,0x0F,0xF0,0x00,0x00, 296 0x00,0x00,0x07,0x9E,0xF8,0xFF,0x1F,0xF3,0xCF,0x3C,0x07,0x9E,0x01,0xC0,0x00,0x00, 297 0x00,0x00,0x03,0xCF,0x3C,0x7F,0x1E,0xF3,0xCF,0x3C,0x0F,0x3C,0xF7,0x80,0x00,0x00, 298 0x00,0x00,0x01,0xE7,0x9C,0x3F,0x1E,0x7B,0xFE,0x3F,0xCE,0x38,0xFE,0x00,0x00,0x00, 299 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 300 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 301 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 302 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 303}; 304
Downloadable files
Schematics option #2 (using two buttons to move the cannon)
New in release 1.2 (default) - cannon movement using two buttons like the original arcade. See the sketch for more info.
Schematics option #2 (using two buttons to move the cannon)

Schematics option #1 (using the potentiometer to move the cannon)
Schematics option #1 (using the potentiometer to move the cannon)

Schematics option #1 (using the potentiometer to move the cannon)
Schematics option #1 (using the potentiometer to move the cannon)

Schematics option #2 (using two buttons to move the cannon)
New in release 1.2 (default) - cannon movement using two buttons like the original arcade. See the sketch for more info.
Schematics option #2 (using two buttons to move the cannon)

Comments
Only logged in users can leave comments