Lektion 2 Logische Operatoren
This commit is contained in:
26
Lektion 2/Logische_Operatoren/Rote_Zone/Rote_Zone.pde
Normal file
26
Lektion 2/Logische_Operatoren/Rote_Zone/Rote_Zone.pde
Normal file
@@ -0,0 +1,26 @@
|
||||
int x = 0;
|
||||
color fillColor;
|
||||
|
||||
void draw() {
|
||||
background(0);
|
||||
|
||||
// Linien zum Markieren der Zone
|
||||
stroke(255);
|
||||
line(25, 0, 25, height);
|
||||
line(75, 0, 75, height);
|
||||
|
||||
// hier wird animiert...
|
||||
fill(fillColor);
|
||||
ellipse(x, 50, 20, 20);
|
||||
x++;
|
||||
if (x > width) {
|
||||
x = 0;
|
||||
}
|
||||
|
||||
// Roter Ball
|
||||
if (x > 25 && x < 75) {
|
||||
fillColor = color(255, 0, 0);
|
||||
} else {
|
||||
fillColor = color(255);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user