Skip to content

Instantly share code, notes, and snippets.

View CSchoel's full-sized avatar

Christopher Schölzel CSchoel

View GitHub Profile
@CSchoel
CSchoel / stickfigure.pde
Created January 27, 2015 13:14
A walking stick figure
//Autor: Christopher Schölzel
class StickFigure {
float v; //Bewegungsgeschwindigkeit
float x; //x-Koordinate
public StickFigure(float x, float v) {
this.x = x;
this.v = v;
}
void walk() {
if (x > width-100) v = -1;
@CSchoel
CSchoel / bingo.pde
Created January 27, 2015 13:13
A simple bingo game
//Autor: Christopher Schölzel
int bingoWidth = 5; //Anzahl der Felder in x-/y-Richtung
int fieldWidth = 50;//Feldbreite in pixeln
int[] bingo = new int[bingoWidth*bingoWidth]; //Feldinhalte
boolean[] marked = new boolean[bingo.length]; //Markierungen der Felder
int numberIndex = 0; //Index der gerade gezogenen Zahl
int[] numberSequence;//(gemischte) Sequenz von gezogenen Zahlen
int numberTimeout = 10000; //Timeout nach dem eine neue Zahl gezogen wird
int lastNumberTime = 0; //Zeitpunkt zu dem die letzte Zahl gezogen wurde
@CSchoel
CSchoel / lines.pde
Created January 27, 2015 13:12
Demonstration of for-loop with moving lines
//Autor: Christopher Schölzel
float x1,y1; //erster Punkt für unteres Linienende
float x2,y2; //zweiter Punkt für unteres Linienende
void setup() {
size(400,400);
x1 = 0;
y1 = height;
x2 = width;
y2 = height;
@CSchoel
CSchoel / pong.pde
Created January 27, 2015 13:10
Simple single-player Pong
//Autor: Christopher Schölzel
float x,y;
float vx,vy;
float radius;
float stickX,stickY;
float stickW,stickH;
boolean gameOver;
int hits;
int maxHits;
@CSchoel
CSchoel / thm_logo.pde
Created January 27, 2015 13:09
Generates the THM logo by faculty and location numbers.
//Autor: Christopher Schölzel
color THMGreen = color(128,186,36);
color THMGray = color(74,92,102);
float boxHeight = 15; //größe einer einzelnen Box im Fenster
int fachbereich = 6; //Fachbereichsnummer
int standort = 1; //Standortnummer
void setup() {
size(500,200);
noLoop();
background(255);
@CSchoel
CSchoel / catch_the_circle.pde
Created January 27, 2015 13:06
Use the mouse to catch the circle.
//Musterlösung zu OOP Aufgabenblatt 1, Aufgabe 3 (WS 14/15)
//Autor: Christopher Schölzel
float x,y; //position
float r; //radius
void setup() {
size(300,300);
background(0);
x = width/2;
y = height/2;
r = 30;