Bluber MX (Blasen)

Matthias Kannengiesser

Erfahrenes Mitglied
Hi Folks,

Heute Nacht haben es mir die Blasen angetan. :)

PHP:
function setzeBlasen(obj, tiefe, xPos, yPos, anzahl, zHoehe, zBreite, Hoehe, Breite) {
	this.createEmptyMovieClip(obj,tiefe);
	this[obj]._x = xPos;
	this[obj]._y = yPos;
	for (i = 1; i <= anzahl; i++) {
		this[obj].attachMovie("blase", "blup" + i, tiefe + i);
		this[obj]["blup" + i].geschw = random(7) + 5;
		this[obj]["blup" + i].wert = random(4);
		this[obj]["blup" + i].richtung = -1;
		this[obj]["blup" + i].ZS = random(50) + 10;
		this[obj]["blup" + i]._xscale = this[obj]["blup" + i].ZS;
		this[obj]["blup" + i]._yscale = this[obj]["blup" + i].ZS;
		this[obj]["blup" + i]._y = random(zHoehe);
		this[obj]["blup" + i]._x = random(zBreite);
		this[obj]["blup" + i].onEnterFrame = function() {
			this._y -= this.geschw;
			this._x -= this.wert;
			this.wert += this.richtung;
			if (this._y <= 0) {
				this._y = Hoehe;
				this.wert = random(4);
				this.geschw = random(7) + 5;
				this.ZS = random(50) + 10;
			}
			if (this._x <= 0) {
				this._x = Breite - this._width;
			}
			if (this._x >= Breite) {
				this._x = 0 + this._width;
			}
			if (this.wert < -3) {
				this.richtung = +1;
			}
			if (this.wert > 3) {
				this.richtung = -1;
			}
		};
	}	
}

setzeBlasen("raum", 1, 0, 0, 30, 400, 550, 400, 550);

Beispiele:
Aqualand
Dreier Bluber

Ihr benötigt lediglich eine Filmsequenz als vorlage - es können natürlich auch verschiedene sein. Denkt jedoch an den Verknüpfungsnamen!

Liebe Grüsse
Matze K.
 
war nun so lange nicht mehr da, komm wieder, und was les ich?
der geist so frech wie eh und je, tzz tzz tzz :-(

aber kompliment, matze, hast nix verlernt =) :eek:

cu, kroschka
 
@kroschka: er ist sogar noch schlimmer geworden...

@matze: wirkt richtig beruhigend. noch ein paar fische
rein und ich kann meinen zweiten monitor in ein
aquarium umfunktionieren :)

blub.
 
Heeeeeey, ich bin doch sachlich geblieben. (bis auf den Blasen-Ausrutscher...)

Alles was ich wissen wollte, war, warum er keine lokale Variable für den Schleifendurchlauf nutzt. :)

Geist
 
Geist: Hehe darauf gehe ich gar nicht erst ein. Die wissenschaftliche Abhandlung dazu gibt es im nächsten Buch. ;)

Hier noch eine Variante samt Strömung und der gewünschten lokalr Var.:

PHP:
function setzeBlasen(obj, tiefe, xPos, yPos, anzahl, zHoehe, zBreite, Hoehe, Breite, Strömung) {
        this.createEmptyMovieClip(obj,tiefe);
        this[obj]._x = xPos;
        this[obj]._y = yPos;
        for (var i = 1; i <= anzahl; i++) {
                this[obj].attachMovie("blase", "blup" + i, tiefe + i);
                this[obj]["blup" + i].geschw = random(7) + 5;
                this[obj]["blup" + i].wert = random(4);
                this[obj]["blup" + i].richtung = -1;
                this[obj]["blup" + i].ZS = random(50) + 10;
                this[obj]["blup" + i]._xscale = this[obj]["blup" + i].ZS;
                this[obj]["blup" + i]._yscale = this[obj]["blup" + i].ZS;
                this[obj]["blup" + i]._y = random(zHoehe);
                this[obj]["blup" + i]._x = random(zBreite);
                this[obj]["blup" + i].onEnterFrame = function() {
                        winkel+=.635
                        this._y -= this.geschw;
                        this._x -= this.wert;
                        this.wert=Math.sin(winkel)*random(8)+Strömung
                        if (this._y <= 0) {
                                this._y = Hoehe;                                
                                this.geschw = random(7) + 5;
                                this.ZS = random(50) + 10;
                        }
                        if (this._x <= 0) {
                                this._x = Breite - this._width;
                        }
                        if (this._x >= Breite) {
                                this._x = 0 + this._width;
                        }
                };
        }
}

setzeBlasen("raum", 1, 0, 0, 30, 500, 550, 400, 550, -6);

Liebe Grüsse
Matze
 
Na gut, dann gedulde ich mich halt noch ein wenig...

Die Variante mit der Strömung erscheint imho vom optischen übrigens um einiges besser. :)

Geist
 
Geist: Will mal nicht so sein - der Grund war es war gestern einfach schon sehr spät und ich war müde, wollt das Teil jedoch los werden. ;)

Achja hier noch eine Anpassung zur Horizonatlen Bewegung der Blasen.

PHP:
function setzeBlasen(obj, tiefe, xPos, yPos, anzahl, zHoehe, zBreite, Hoehe, Breite) {
	this.createEmptyMovieClip(obj,tiefe);
	this[obj]._x = xPos;
	this[obj]._y = yPos;
	for (var i = 1; i <= anzahl; i++) {
		this[obj].attachMovie("blase", "blump" + i, tiefe + i);
		this[obj]["blump" + i].geschw = random(7) + 5;
		this[obj]["blump" + i].wert = random(4);
		this[obj]["blump" + i].richtung = -1;
		this[obj]["blump" + i].ZS = random(50) + 10;
		this[obj]["blump" + i]._xscale = this[obj]["blump" + i].ZS;
		this[obj]["blump" + i]._yscale = this[obj]["blump" + i].ZS;
		this[obj]["blump" + i]._y = random(zHoehe);
		this[obj]["blump" + i]._x = random(zBreite);
		this[obj]["blump" + i].onEnterFrame = function() {
			this._y -= this.geschw;
			this._x -= this.wert;
			this.wert += this.richtung;
			if (this._y <= 0) {
				this._y = Hoehe;
				this.wert = random(4);
				this.geschw = random(7) + 5;
				this.ZS = random(50) + 10;
			}
			if (this._x <= 0) {
				this._x = Breite - this._width;
			}
			if (this._x >= Breite) {
				this._x = 0 + this._width;
			}
			if (this.wert < -random(3)) {
				this.richtung = +1;
			}
			if (this.wert > random(3)) {
				this.richtung = -1;
			}			
		};
	}	
}

setzeBlasen("raum", 1, 0, 0, 30, 400, 550, 400, 550);

Liebe Grüsse
Matze K.
 
sorry fürs thread hochholen, aber ich wollte fragen, ob es hierfür auch die *.fla gibt :eek:

weil ich versteh nicht ganz, wie ich das einbauen muss / soll / kann :)
( Hab von AS nich wirklich Ahnung :( )
 

Neue Beiträge

Zurück