This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Autor: Christopher Schölzel | |
float x,y; | |
float vx,vy; | |
float radius; | |
float stickX,stickY; | |
float stickW,stickH; | |
boolean gameOver; | |
int hits; | |
int maxHits; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Autor: Christopher Schölzel | |
//Klasse für die Kanonenkugel | |
class CannonBall { | |
float x,y; //Position der Kugel | |
float vx,vy; //Geschwindigkeit auf der x- bzw. y-Achse | |
float d; //Durchmesser der Kugel | |
float dragCoefficient = 0.001; //Luftwiderstand | |
Environment env; | |
CannonBall(float x, float y, float vx, float vy, float d, Environment env) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Autor: Christopher Schölzel | |
class Bar { | |
int value; | |
boolean marked; | |
Bar(int value) { | |
this.value = value; | |
marked = false; | |
} | |
//Zeichnet den balken an position (x,y) mit der Breite b und | |
//dem Streckungsfaktor hFac für die Balkenhöhe. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Autor: Christopher Schölzel | |
//Abstrakte Superklasse für Bird und Balloon | |
//Vermeidet, dass z.b. visible doppelt implementiert werden muss | |
abstract class Movable { | |
float w,h; | |
float x,y; | |
Movable(float w, float h, float x, float y) { | |
this.w = w; | |
this.h = h; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Autor: Christopher Schölzel | |
class Field { | |
int[][] content; | |
float fh,fw; | |
float px,py; | |
Field(float posX, float posY, int fieldsX, int fieldsY, float fieldWidth, float fieldHeight) { | |
content = new int[fieldsY][fieldsX]; | |
this.fw = fieldWidth; | |
this.fh = fieldHeight; |
OlderNewer