====== Vererbung ====== ===== Einführungsbeispiel: Particle engine ===== World w = new World(800, 600); while(true) { new Particle(Math.random() * 20 - 10, Math.random() *(-20) - 10, Math.random() * 20 - 10); } class Particle extends Rectangle { double vx; double vy; double vw; public Particle(double vx1, double vy1, double vw1) { super(380, 550, 40, 40); vx = vx1; vy = vy1; vw = vw1; setBorderColor(null); setFillColor( Math.floor(Math.random() * 255 * 255 * 255)); setAlpha(Math.random()); } public void act() { move(vx, vy); rotate(vw); vy = vy + 0.5; if(isOutsideView()) { destroy(); } } }