-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuttons.cpp
More file actions
95 lines (80 loc) · 2.04 KB
/
Copy pathbuttons.cpp
File metadata and controls
95 lines (80 loc) · 2.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
#include "buttons.h"
void pButReturnBall::onActive(){
if (game.ballCount > 0){
game.outputs[outReturnBall]->activate();
game.outputs[outDropTargets]->activate();
}
if (game.ballCount <= 0){
game.resetLoop();
}
}
void pButBallReturned::onActive(){
game.ballCount--;
Serial.print(game.ballCount);
Serial.write(" balls left\n");
}
void pButStart::onActive(){
Serial.write("Start Pressed!\n");
if (game.ballCount <= 0){
game.reset();
}
}
void pButBumper1::onActive(){
game.outputs[outBumper1]->activate();
}
void pButBumper2::onActive(){
game.outputs[outBumper2]->activate();
}
void pButBumper3::onActive(){
game.outputs[outBumper3]->activate();
}
void pButDropTargets::onActive(){
game.score->add(200);
game.dropTargetsDown = true;
if (game.dropTargetAbility){
game.outputs[outDropTargets]->activate();
}
}
void pButFlickup::onActive(){
game.score->add(100);
game.outputs[outFlickUp]->activate();
if (game.targetNum[0] && game.targetNum[1] && game.targetNum[0] && game.targetNum[2] && game.dropTargetsDown){
game.outputs[outDropTargets]->activate();
game.dropTargetAbility = true;
game.targetNum[0] = false;
game.targetNum[1] = false;
game.targetNum[2] = false;
game.lights[litTarget1]->lightOn();
game.lights[litTarget2]->lightOn();
game.lights[litTarget3]->lightOn();
}
}
void pButLowBumperRight::onActive(){
game.score->add(10);
game.outputs[outLowBumperRight]->activate();
}
void pButLowBumperLeft::onActive(){
game.score->add(10);
game.outputs[outLowBumperLeft]->activate();
}
void pButTarget1::onActive(){
game.targetNum[0] = true;
game.lights[litTarget1]->lightOff();
game.score->add(25);
}
void pButTarget2::onActive(){
game.score->add(25);
if (game.targetNum[0] == true){
game.targetNum[1] = true;
game.lights[litTarget2]->lightOff();
}
}
void pButTarget3::onActive(){
game.score->add(25);
if (game.targetNum[1] == true && game.targetNum[2] == false){
game.targetNum[2] = true;
game.outputs[outDropTargets]->activate();
game.dropTargetAbility = false;
game.lights[litTarget3]->lightOff();
}
}