Lab1

Dependencies:   mbed C12832

graphics.h

Committer:
kwstasfane1
Date:
2020-11-10
Revision:
7:45e908a56319
Parent:
0:cb8d734a17f1
Child:
11:aa8de6ff4003

File content as of revision 7:45e908a56319:

static char sprite1[] =
{0x20,0x80,0x11,0x00,0x3F,0x80,0x6E,0xC0,0xFF,0xE0,0xBF,0xA0,0xA0,0xA0,0x1B ,0x00} ;
static char sprite2[] =
{0x20,0x80,0x91,0x20,0xBF,0xA0,0xEE,0xE0,0xFF,0xE0,0x3F,0x80,0x20,0x80,0x1B ,0x00} ;

static char shooter[] =
{0x04,0x00,0x0E,0x00,0x0E,0x00,0x7F,0xC0,0xFF,0xE0,0xFF,0xE0,0xFF,0xE0,0xFF ,0xE0} ;
 
struct sprite{
 char snum; //sprite number
 int xpos; // x position
 int ypos; // y position
 int oldy; // prvious y pos
 char active; // 1 = sprite displayed 0 = sprite destroyed
 char *type; //sprite1 or 2
};


sprite spritetab[] = {
 {0,1,0,0,1,sprite1},
 {1,16,0,0,1,sprite2},
 {2,32,0,0,1,sprite1},
 {3,48,0,0,1,sprite2},
 {4,64,0,0,1,sprite1},
 {5,80,0,0,1,sprite2},
 {6,96,0,0,1,sprite1},
 {7,112,0,0,1,sprite2}
};

sprite reverse_spritetab[] = {
 {0,1,0,0,1,sprite2},
 {1,16,0,0,1,sprite1},
 {2,32,0,0,1,sprite2},
 {3,48,0,0,1,sprite1},
 {4,64,0,0,1,sprite2},
 {5,80,0,0,1,sprite1},
 {6,96,0,0,1,sprite2},
 {7,112,0,0,1,sprite1}
};


// Some defines
#define WIN 1
#define LOSE 0
#define BASE 24 // the display baseline Y location for the shooter
//LCD display
C12832 lcd(p5, p7, p6, p8, p11);
// The 4 on board LEDs
DigitalOut myled(LED1);
DigitalOut myled2(LED2);
DigitalOut myled3(LED3);
DigitalOut myled4(LED4);
// RGB LED
PwmOut r (p23);
PwmOut g (p24);
//PwmOut b (p25);
 //joystick
 DigitalIn joyD(p12);
 DigitalIn joyL(p13);
 DigitalIn joyC(p14);
 DigitalIn joyU(p15);
 DigitalIn joyR(p16);