Zurück   Flashforum > Flash > ActionScript > ActionScript 1

Antwort
 
LinkBack Themen-Optionen Ansicht
Alt 21-03-2007, 19:59   #1 (permalink)
fscommander
 
Benutzerbild von Dublay
 
Registriert seit: Jan 2004
Beiträge: 197
AS - Schneefall umdrehen

HTML-Code:
function schnee(pAnzahl, pBreite, pHoehe,pFlockenDim,pFlockenDichte) {
	for (var i = 0; i<=pAnzahl; i++) {
		this.attachMovie("fClip", "flocke"+i, i);
		this["flocke"+i].skal = 50+(Math.random()*pFlockenDim);
		this["flocke"+i].alpha = 20+(Math.random()*pFlockenDichte);
		this["flocke"+i]._xscale = this["flocke"+i].skal;
		this["flocke"+i]._yscale = this["flocke"+i].skal;
		this["flocke"+i]._alpha = this["flocke"+i].alpha;
		this["flocke"+i].xpos = this["flocke"+i]._x;
		this["flocke"+i]._x = -10+(Math.random()*pBreite);
		this["flocke"+i].zufall = 1+(Math.random()*2); //geschw.
		this["flocke"+i]._y = -10+(Math.random()*pHoehe);
		this["flocke"+i].wind = -Math.PI+(Math.random()*Math.PI);
		this["flocke"+i].onEnterFrame = function() {
			this.rad += ((this.wind/180)*Math.PI);
			this._x -= Math.cos(this.rad);
			this._y += this.zufall;
			if (this._y>=pHoehe) {
				this._y = -5;
			}
			if ((this._x>=pBreite) || (this._x<=0)) {
				this._x = -10+(Math.random()*pBreite);
			}
		};
	}
}

schnee(20,230,70,100,50);
Wie drehe ich das um, das z.B. der Schnee von unten nach oben fällt?
__________________
daily entertainment
Dublay ist offline   Mit Zitat antworten
Alt 21-03-2007, 20:10   #2 (permalink)
Achim Math.PI
 
Benutzerbild von bloba
 
Registriert seit: Jul 2001
Ort: cool Colonia
Beiträge: 11.642
PHP-Code:
function schnee(pAnzahlpBreitepHoehe,pFlockenDim,pFlockenDichte) {
    for (var 
0i<=pAnzahli++) {
        
this.attachMovie("fClip""flocke"+ii);
        
this["flocke"+i].skal 50+(Math.random()*pFlockenDim);
        
this["flocke"+i].alpha 20+(Math.random()*pFlockenDichte);
        
this["flocke"+i]._xscale this["flocke"+i].skal;
        
this["flocke"+i]._yscale this["flocke"+i].skal;
        
this["flocke"+i]._alpha this["flocke"+i].alpha;
        
this["flocke"+i].xpos this["flocke"+i]._x;
        
this["flocke"+i]._x = -10+(Math.random()*pBreite);
        
this["flocke"+i].zufall 1+(Math.random()*2); //geschw.
        
this["flocke"+i]._y = +10+(Math.random()*pHoehe);
        
this["flocke"+i].wind = -Math.PI+(Math.random()*Math.PI);
        
this["flocke"+i].onEnterFrame = function() {
            
this.rad += ((this.wind/180)*Math.PI);
            
this._x -= Math.cos(this.rad);
            
this._y -= this.zufall;
            if (
this._y<=0) {
                
this._y = +5;
            }
            if ((
this._x>=pBreite) || (this._x<=0)) {
                
this._x = -10+(Math.random()*pBreite);
            }
        };
    }
}

schnee(20,230,700,100,50); 
__________________
gruß bloba

2 x onkel² b_d

Geändert von bloba (21-03-2007 um 20:13 Uhr)
bloba ist offline   Mit Zitat antworten
Alt 21-03-2007, 20:12   #3 (permalink)
Flashbitch
 
Benutzerbild von X-Tender
 
Registriert seit: Oct 2003
Ort: Hannover
Beiträge: 279
Ich glaube ehr das:

this._y += this.zufall;


in das

this._y -= this.zufall;
__________________
Fuchtelworld
X-Tender ist offline   Mit Zitat antworten
Alt 21-03-2007, 20:28   #4 (permalink)
fscommander
 
Benutzerbild von Dublay
 
Registriert seit: Jan 2004
Beiträge: 197
Das von Bloba drehts um, allerdings bleiben dann die Schneeflocken oben am Bildschirm hängen und zucken seltsam durch die Gegend.

Das von X-Tender spielt leider nur eine Flocke ab.
__________________
daily entertainment
Dublay ist offline   Mit Zitat antworten
Alt 21-03-2007, 20:48   #5 (permalink)
Achim Math.PI
 
Benutzerbild von bloba
 
Registriert seit: Jul 2001
Ort: cool Colonia
Beiträge: 11.642
Zitat:
Zitat von Dublay Beitrag anzeigen
Das von Bloba drehts um, allerdings bleiben dann die Schneeflocken oben am Bildschirm hängen und zucken seltsam durch die Gegend.

Das von X-Tender spielt leider nur eine Flocke ab.
naja n bischen mitdenken hat noch keinem geschadet....

PHP-Code:
function schnee(pAnzahlpBreitepHoehepFlockenDimpFlockenDichte) {
    for (var 
0i<=pAnzahli++) {
        
this.attachMovie("fClip""flocke"+ii);
        
this["flocke"+i].skal 50+(Math.random()*pFlockenDim);
        
this["flocke"+i].alpha 20+(Math.random()*pFlockenDichte);
        
this["flocke"+i]._xscale this["flocke"+i].skal;
        
this["flocke"+i]._yscale this["flocke"+i].skal;
        
this["flocke"+i]._alpha this["flocke"+i].alpha;
        
this["flocke"+i].xpos this["flocke"+i]._x;
        
this["flocke"+i]._x = -10+(Math.random()*pBreite);
        
this["flocke"+i].zufall 1+(Math.random()*2);
        
//geschw.
        
this["flocke"+i]._y = -10+(Math.random()*pHoehe);
        
this["flocke"+i].wind = -Math.PI+(Math.random()*Math.PI);
        
this["flocke"+i].onEnterFrame = function() {
            
this.rad += ((this.wind/180)*Math.PI);
            
this._x -= Math.cos(this.rad);
            
this._y -= this.zufall;
            if (
this._y<=0) {
                
this._y = +50;
            }
            if ((
this._x>=pBreite) || (this._x<=0)) {
                
this._x = -10+(Math.random()*pBreite);
            }
        };
    }
}
schnee(202307010050); 
__________________
gruß bloba

2 x onkel² b_d
bloba ist offline   Mit Zitat antworten
Alt 21-03-2007, 21:00   #6 (permalink)
fscommander
 
Benutzerbild von Dublay
 
Registriert seit: Jan 2004
Beiträge: 197
Würd ich ja gerne, ich hab nur leider keinen Durchblick ^^

Aber ich hab zu Danken, es läuft!

Noch eine Kleinigkeit: Die Flocken fallen ja jetzt über das ganze Bild (bei mir leider noch ohne Windeinfluss, warum auch immer), wie muss der Code aussehen, das links zum Beispiel 50 Pixel sind in denen kein Schnee fällt?
__________________
daily entertainment

Geändert von Dublay (21-03-2007 um 21:05 Uhr)
Dublay ist offline   Mit Zitat antworten
Alt 21-03-2007, 22:32   #7 (permalink)
fscommander
 
Benutzerbild von Dublay
 
Registriert seit: Jan 2004
Beiträge: 197
Hat sich erledigt

Vielen Dank Euch Beiden!
__________________
daily entertainment
Dublay ist offline   Mit Zitat antworten
Antwort

Lesezeichen

Themen-Optionen
Ansicht

Forumregeln
Es ist Ihnen nicht erlaubt, neue Themen zu verfassen.
Es ist Ihnen nicht erlaubt, auf Beiträge zu antworten.
Es ist Ihnen nicht erlaubt, Anhänge hochzuladen.
Es ist Ihnen nicht erlaubt, Ihre Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks sind an
Pingbacks sind an
Refbacks sind an



Alle Zeitangaben in WEZ +1. Es ist jetzt 04:20 Uhr.

Domains, Webhosting & Vserver von Host Europe
Unterstützt das Flashforum!
Adobe User Group


Copyright ©1999 – 2012 Marc Thiele