The Arduino IDE requires that a sketch be located in a folder of the same name. Although the name of the repository does match the sketch name, when GitHub's popular Clone or download > Download ZIP feature is used to download the contents of a repository the branch/release/commit name is appended to the folder name, causing a mismatch. When opening a file that does not meet this sketch/folder name matching requirement the Arduino IDE presents a dialog: The file "TWANG32.ino" needs to be inside a sketch folder named "TWANG32". Create this folder, move the file, and continue? After clicking "OK" the Arduino IDE currently moves only the file TWANG32.ino to the new folder, leaving behind the other source files. This causes compilation of the sketch to fail: TWANG32-master\TWANG32\TWANG32.ino:30:23: fatal error: twang_mpu.h: No such file or directory
43 lines
532 B
C++
43 lines
532 B
C++
#include "Arduino.h"
|
|
|
|
class Boss
|
|
{
|
|
public:
|
|
void Spawn();
|
|
void Hit();
|
|
void Kill();
|
|
bool Alive();
|
|
int _pos;
|
|
int _lives;
|
|
int _ticks;
|
|
private:
|
|
bool _alive;
|
|
};
|
|
|
|
void Boss::Spawn(){
|
|
_pos = 800;
|
|
_lives = 3;
|
|
_alive = 1;
|
|
}
|
|
|
|
void Boss::Hit(){
|
|
_lives --;
|
|
if(_lives == 0) {
|
|
Kill();
|
|
return;
|
|
}
|
|
if(_lives == 2){
|
|
_pos = 200;
|
|
}else if(_lives == 1){
|
|
_pos = 600;
|
|
}
|
|
}
|
|
|
|
bool Boss::Alive(){
|
|
return _alive;
|
|
}
|
|
|
|
void Boss::Kill(){
|
|
_alive = 0;
|
|
}
|