import processing.opengl.*; int speed = 4; //pixels per Frame int breite = 8; int anzahl = 100; Stripe[] stripes = new Stripe[anzahl]; color colorNow = color(int(random(20,255)),int(random(20,255)), int(random(0,255))); color backgroundColor = color(0,0,0); boolean growing = false; int Person_minFramePause = 1; // darf nicht kleiner als 1 sein !!! int Person_maxFramePause = 6; int personDisplay; PFont arial; class Person { int speed, startSpeed, position, nextFrame; color c; Person (){ this.restart(0); } void restart(int pause) { //position int f = int(random(-5,5)); if (f < 0) { position = 0; } else { position = -stripes.length+1; } //speed startSpeed = speed = int(random(Person_minFramePause,Person_maxFramePause)); //nextFrame nextFrame = frameCount + speed + pause; //color c = color(int(random(20,255)),int(random(20,255)), int(random(0,255))); } } Vector persons = new Vector(); void setup() { size(800,300, OPENGL); background(0,0,0); fill(0, 153); noStroke(); frameRate(30); for (int i = 0; i = width-3){ colorNow = color(int(random(30,255)),int(random(30,255)), int(random(30,255))); } } void keyPressed(){ if (key == CODED){ if (keyCode == UP){ if (speed < 30){ speed += 1; } } else if (keyCode == DOWN){ if (speed > 1) { speed -= 1; } } else if (keyCode == RIGHT){ persons.add(new Person()); personDisplay = frameCount + 30; } else if (keyCode == LEFT){ if (!persons.isEmpty()){ persons.remove(0); personDisplay = frameCount + 30; } } } else if (key == ' '){ noLoop(); } } void keyReleased(){ if (key == ' '){ loop(); } } class Stripe extends Vector{ int x; class Lamp { color c; int h; Lamp (color col, int hoehe){ c = col; h = hoehe; } } Stripe (int xpos){ x = xpos; } void run(color c) { if (!this.isEmpty()){ Lamp lamp = (Lamp)this.get(this.size()-1); if (lamp.c != c){ this.add(new Lamp(c,0)); }else { if (lamp.h > 30) { lamp.h -= 30; } } } else { this.add(new Lamp(c,0)); } } void update(){ for (int i = 0; i 0) { if (lamp.h < height) { fill(lamp.c, 5); rect(x, 0, breite, lamp.h*0.5); }else if(lamp.h < height+255/5*speed*1.5){ fill(lamp.c, 5); rect(x, 0, breite, height); }else { this.remove(i); } } } } } }