Ahmed Oumer / asteroid_shooting

Dependencies:   microbit

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers Spacecraft.cpp Source File

Spacecraft.cpp

00001 #include "Spacecraft.h"
00002 
00003 Spacecraft::Spacecraft(){
00004     setX(2);
00005     setY(4);
00006 }
00007 void Spacecraft::moveLeft(){
00008     int x = getX() - 1;
00009     if(x < 0) x = 4; 
00010     setX(x);
00011 }
00012 void Spacecraft::moveRight(){
00013     m_x = (m_x + 1) % 5;
00014 }
00015 bool Spacecraft::isBlinking(){
00016     return blinking;
00017 }
00018 void Spacecraft::blink(){
00019     blinking = true;
00020 }