-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathb_klingon.ino
More file actions
44 lines (37 loc) · 1.02 KB
/
Copy pathb_klingon.ino
File metadata and controls
44 lines (37 loc) · 1.02 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
void drawKlingonShips() {
for (byte i=0; i < NUM_KLINGONSHIPS; i++) {
gb.display.drawBitmap(klingonShips[i].x,klingonShips[i].y,klingonship,ROTCCW,NOFLIP);
}
}
/**
* Materialisiert ein neues Klingonenschiff in der neutralen Zone.
* (Links ausserhalb des sichbaren Bereichs des LCD Screens)
*/
void spawnKlingonShip(const byte i) {
klingonShips[i].x = random(LCDWIDTH , 127);
klingonShips[i].y = random(0,LCDHEIGHT-SPRITE_KLINGONSHIP_WIDTH);
klingonShips[i].vx = random(1,3);
klingonShips[i].vy = 0;
klingonShips[i].exploding = false;
}
/**
* Setzt die Startwerte fuer alle
* feindlichen Klingonenschiffe.
*/
void initKlingonShips() {
for (byte i=0; i < NUM_KLINGONSHIPS; i++) {
spawnKlingonShip(i);
}
}
void updateKlingonShip(const byte i) {
klingonShips[i].x -= klingonShips[i].vx;
klingonShips[i].y -= klingonShips[i].vy;
if (klingonShips[i].x < - 16) {
spawnKlingonShip(i);
}
}
void updateKlingonShips() {
for (byte i=0; i < NUM_KLINGONSHIPS; i++) {
updateKlingonShip(i);
}
}