SharpShooter

Dependencies:   4DGL-uLCD-SE SDFileSystem mbed-rtos mbed wave_player

Shooter.h

Committer:
jboettcher
Date:
2016-10-28
Revision:
11:55b65415b6ba
Parent:
6:7f8c3169483a
Child:
12:2f358065ba3f

File content as of revision 11:55b65415b6ba:

extern uLCD_4DGL uLCD;

class Shooter
{
    int x;

public:
    Shooter();
    void drawShooter();
    void eraseShooter();
    void moveLeft();
    void moveRight();
};

Shooter::Shooter() {
    x = 64;
}

void Shooter::drawShooter() {
    uLCD.triangle(x, 115, x-5, 125, x-5, 125, 0x3300ff);
}

void Shooter::eraseShooter() {
    uLCD.triangle(x, 115, x-5, 125, x-5, 125, 0x000000);
}

void Shooter::moveLeft() {
    eraseShooter();
    if (x==64) x = 32;
    if (x==96) x = 64;
    drawShooter();
}

void Shooter::moveRight() {
    eraseShooter();
    if (x==64) x = 96;
    if (x==32) x = 64;
    drawShooter();
}