// Lutz Tautenhahn (c) 1995, 1999 var MaxS1=15; var MaxS2=20; var MaxS3=25; var MaxS4=30; var MaxS5=40; var key='a'; var Zyklus=16; function Staub(InitX, InitY, InitPeriode, InitFarbe) { this.fX=InitX; this.fY=InitY; this.X=InitX; this.Y=InitY; this.Periode=InitPeriode; this.Farbe=InitFarbe; this.GetX=function() { return(this.X); }; this.GetY=function() { return(this.Y); }; this.GetPeriode=function() { return(this.Periode); }; this.GetFarbe=function() { return(this.Farbe); }; this.Verschieben=function(dX, dY) { this.fX+=dX; this.fY+=dY; this.X=Math.floor(this.fX); this.Y=Math.floor(this.fY); }; this.Vorsetzen=function() { while (this.X<0) this.X+=this.Periode; }; this.Ruecksetzen=function() { while (this.X>this.Periode) this.X-=this.Periode; }; this.Zeichnen=function() { setcolor(this.Farbe); setpixel(this.X, this.Y); }; this.ReiheZeichnen=function() { var ii, TempX, TempPeriode; TempX = this.GetX(); TempPeriode = this.GetPeriode(); for (ii=-1; this.X<540+100; ii++) { this.X=TempX+ii*TempPeriode; this.Zeichnen(); } this.X=TempX; }; this.Bewegen=function(dX) { this.ReiheZeichnen(); this.Verschieben(dX, 0); if (dX < 0) this.Vorsetzen(); if (dX > 0) this.Ruecksetzen(); }; return(this); } function Koerper(InitX, InitY, InitPeriode, InitGroesse, InitFarbe) { Staub.call(this, InitX, InitY, InitPeriode, InitFarbe); this.Groesse = InitGroesse; this.GetGroesse=function() { return(this.Groesse); }; return(this); } function Fisch(InitX, InitY, InitPeriode, InitGroesse, InitFarbe, InitZweitFarbe, InitTyp) { Koerper.call(this, InitX, InitY, InitPeriode, InitGroesse, InitFarbe); this.ZweitFarbe=InitZweitFarbe; this.Typ=InitTyp; this.Zeichnen=function() { var ii; if (this.Typ==0) { setcolor(this.Farbe); for (ii=0; ii<=this.Groesse; ii++) { moveto(this.X+4*this.Groesse, this.Y+this.Groesse); lineto(this.X+2*this.Groesse, this.Y+ii); moveto(this.X-4*this.Groesse, this.Y+this.Groesse); lineto(this.X-2*this.Groesse, this.Y+ii); } fillellipse(this.X-3*this.Groesse, this.Y-this.Groesse, this.X+3*this.Groesse, this.Y+this.Groesse); setcolor(this.ZweitFarbe); moveto(this.X-4*this.Groesse,this.Y+this.Groesse); lineto(this.X+4*this.Groesse,this.Y+this.Groesse); } if (this.Typ==1) { setcolor(this.Farbe); for (ii=-2*this.Groesse; ii<=2*this.Groesse; ii++) { moveto(this.X-14*this.Groesse, this.Y+ii); lineto(this.X-8*this.Groesse, this.Y); } fillellipse(this.X-9*this.Groesse, this.Y-3*this.Groesse, this.X+9*this.Groesse, this.Y+3*this.Groesse); setcolor(this.ZweitFarbe); moveto(this.X-3*this.Groesse,this.Y+this.Groesse); lineto(this.X,this.Y); moveto(this.X+6*this.Groesse,this.Y-this.Groesse); lineto(this.X+7*this.Groesse,this.Y-this.Groesse); moveto(this.X+6*this.Groesse,this.Y+this.Groesse); lineto(this.X+8*this.Groesse,this.Y+2*this.Groesse); } if (this.Typ==-1) { setcolor(this.Farbe); for (ii=-2*this.Groesse; ii<=2*this.Groesse; ii++) { moveto(this.X+14*this.Groesse, this.Y+ii); lineto(this.X+8*this.Groesse, this.Y); } fillellipse(this.X-9*this.Groesse, this.Y-3*this.Groesse, this.X+9*this.Groesse, this.Y+3*this.Groesse); setcolor(this.ZweitFarbe); moveto(this.X+3*this.Groesse,this.Y+this.Groesse); lineto(this.X,this.Y); moveto(this.X-6*this.Groesse,this.Y-this.Groesse); lineto(this.X-7*this.Groesse,this.Y-this.Groesse); moveto(this.X-6*this.Groesse,this.Y+this.Groesse); lineto(this.X-8*this.Groesse,this.Y+2*this.Groesse); } if (this.Typ==2) { setcolor(this.ZweitFarbe); for (ii=-2*this.Groesse; ii<=2*this.Groesse; ii++) { moveto(this.X-14*this.Groesse, this.Y+ii); lineto(this.X-8*this.Groesse, this.Y); } bar(this.X-3*this.Groesse, this.Y-6*this.Groesse, this.X+3*this.Groesse, this.Y-5*this.Groesse); setcolor(this.Farbe); fillellipse(this.X-9*this.Groesse, this.Y-5*this.Groesse, this.X+9*this.Groesse, this.Y+5*this.Groesse); setcolor(this.ZweitFarbe); moveto(this.X-3*this.Groesse,this.Y+this.Groesse); lineto(this.X,this.Y); moveto(this.X+6*this.Groesse,this.Y-this.Groesse); lineto(this.X+7*this.Groesse,this.Y-this.Groesse); moveto(this.X+6*this.Groesse,this.Y+this.Groesse); lineto(this.X+8*this.Groesse,this.Y+2*this.Groesse); } if (this.Typ==-2) { setcolor(this.ZweitFarbe); for (ii=-2*this.Groesse; ii<=2*this.Groesse; ii++) { moveto(this.X+14*this.Groesse, this.Y+ii); lineto(this.X+8*this.Groesse, this.Y); } bar(this.X-3*this.Groesse,this.Y-6*this.Groesse,this.X+3*this.Groesse,this.Y-5*this.Groesse); setcolor(this.Farbe); fillellipse(this.X-9*this.Groesse, this.Y-5*this.Groesse, this.X+9*this.Groesse, this.Y+5*this.Groesse); setcolor(this.ZweitFarbe); moveto(this.X+3*this.Groesse,this.Y+this.Groesse); lineto(this.X,this.Y); moveto(this.X-6*this.Groesse,this.Y-this.Groesse); lineto(this.X-7*this.Groesse,this.Y-this.Groesse); moveto(this.X-6*this.Groesse,this.Y+this.Groesse); lineto(this.X-8*this.Groesse,this.Y+2*this.Groesse); } }; return(this); } function Alge(InitX, InitY, InitPeriode, InitGroesse, InitFarbe) { Koerper.call(this, InitX, InitY, InitPeriode, InitGroesse, InitFarbe); this.Zweig=[[],[],[],[],[]]; var ii, jj; for (ii=0; ii<4; ii++) { for (jj=0; jj<5; jj++) this.Zweig[ii][jj] = rand()%8-4; } this.Zeichnen=function() { var ii, jj, XTemp, YTemp; setcolor(this.Farbe); for (ii=0; ii<4; ii++) { XTemp = this.X; YTemp = this.Y; for (jj=0; jj<5; jj++) { moveto(XTemp,YTemp); XTemp += this.Groesse*this.Zweig[ii][jj]; YTemp -= (6*this.Groesse+ii); lineto(XTemp,YTemp); } } }; this.Bewegen=function() { var ii, jj; for (ii=0; ii<4; ii++) { for (jj=0; jj<5; jj++) this.Zweig[ii][jj] = (this.Zweig[ii][jj]+rand()%8-4)/2; } }; return(this); } var S1=[]; for (j=0; j