Zurück   Flashforum > Flash > ActionScript > ActionScript 1

Antwort
 
LinkBack Themen-Optionen Ansicht
Alt 31-01-2006, 09:18   #1 (permalink)
Neuer User
 
Registriert seit: Jun 2002
Beiträge: 345
random motion

hallo
möchte 60 Bälle erstellen und die dann randommassig scalen und bewegen
PHP-Code:
for (i=0i<60i++) {
    var 
temp this.attachMovie("ball""ball"+ii);
    
temp._x Math.random()*550;
    
temp._y Math.random()*400;
    
temp.zielX Math.round(Math.random()*550);
    
temp.zielY Math.round(Math.random()*400);
    
temp._xscale Math.random()*200+40;
    
    
trace (ball1._xscale); // rückgabe immer nur ein konstanter wert
    
    
temp._yscale temp._xscale;
    
temp.onEnterFrame mover;
}
function 
mover() {
    
this._x += (this.zielX-this._x)/3;
    
this._y += (this.zielY-this._y)/3;
    if (
Math.round(this._x) == this.zielX) {
        
this.zielX Math.round(Math.random()*550);
        
this.zielY Math.round(Math.random()*400);
    }

Was ist in diesem script falsch ?
Danke
flashmaus ist offline   Mit Zitat antworten
Alt 31-01-2006, 09:26   #2 (permalink)
pensionist
 
Benutzerbild von troner
 
Registriert seit: Jan 2003
Ort: Thalheim b. Wels
Beiträge: 568
hallo

na ja wenn du nur _xscale von "ball1" traced kann ja nur ein konstanter wert rauskommen!

PHP-Code:
trace (ball1._xscale); // rückgabe immer nur ein konstanter wert 
trace (temp._xscale); // ;-) 
mfg
troner ist offline   Mit Zitat antworten
Alt 31-01-2006, 10:19   #3 (permalink)
Neuer User
 
Registriert seit: Jun 2002
Beiträge: 345
danke erstmal,
ich dachte ball1 wird über die Zeit grösser - also je "älter" der Ball desto "dicker". Das ist aber so nicht. Die Bälle wandern randommässig über die Bühne werden aber nicht gescaled und bleiben dann sogar für kurze Zeit stehen
???
flashmaus ist offline   Mit Zitat antworten
Alt 31-01-2006, 10:27   #4 (permalink)
°.oO°O.o°.oO.o°O
 
Benutzerbild von bamboocha
 
Registriert seit: Jun 2005
Ort: CH
Beiträge: 1.490
Dann müsstest du auch eine Vergrösserung veranlassen!
PHP-Code:
function mover() {
    
this._xscale this._yscale ~= 1.1
    
this._x += (this.zielX-this._x)/3
    
this._y += (this.zielY-this._y)/3
    if (
Math.round(this._x) == this.zielX) { 
        
this.zielX Math.round(Math.random()*550); 
        
this.zielY Math.round(Math.random()*400); 
    } 

__________________
There is no way to happiness, happiness is the way! - Buddha
bamboocha ist offline   Mit Zitat antworten
Alt 31-01-2006, 10:31   #5 (permalink)
Neuer User
 
Registriert seit: Jun 2002
Beiträge: 345
die wird doch aber in der for schleife für jedes i angelegt
In der Funktion mover ist doch nur eine Verlangsamung drin und eine neue Zielangabe
flashmaus ist offline   Mit Zitat antworten
Alt 31-01-2006, 10:37   #6 (permalink)
°.oO°O.o°.oO.o°O
 
Benutzerbild von bamboocha
 
Registriert seit: Jun 2005
Ort: CH
Beiträge: 1.490
Ja, aber wenn du dachtest, dass die mit der Zeit immer grösser werden, musst du sie auch irgendwo grösser werden lassen!
__________________
There is no way to happiness, happiness is the way! - Buddha
bamboocha ist offline   Mit Zitat antworten
Alt 31-01-2006, 10:54   #7 (permalink)
Neuer User
 
Registriert seit: Jun 2002
Beiträge: 345
danke nochmal
habs jetzt so versucht
PHP-Code:
for (i=0i<60i++) { 
    var 
temp this.attachMovie("ball""ball"+ii); 
    
temp._x Math.random()*550
    
temp._y Math.random()*400
    
temp.zielX Math.round(Math.random()*550); 
    
temp.zielY Math.round(Math.random()*400); 
    
temp._xscale Math.random()*200+40;    
    
temp._yscale temp._xscale
    
temp._xscale temp._xscale 5;  // neu
    
temp.onEnterFrame mover

function 
mover() { 
    
this._x += (this.zielX-this._x)/3
    
this._y += (this.zielY-this._y)/3
    if (
Math.round(this._x) == this.zielX) { 
        
this.zielX Math.round(Math.random()*550); 
        
this.zielY Math.round(Math.random()*400); 
    } 

tut sich aber auch nix
(this._xscale = this._yscale ~= 1.1;
damit hats mir immer Fehler angezeigt)
flashmaus ist offline   Mit Zitat antworten
Alt 31-01-2006, 10:59   #8 (permalink)
pensionist
 
Benutzerbild von troner
 
Registriert seit: Jan 2003
Ort: Thalheim b. Wels
Beiträge: 568
is ja nicht so schwer!

wie bambocha schon geschireben hat wenn du willst das der ball auch smooth gescaled wird musst du das auch im enterframe machen in der for schleife wird es ja nur "1" mal erledigt....

PHP-Code:
for (i=0i<10i++) { 
    var 
temp this.attachMovie("ball""ball"+ii); 
    
temp._x Math.random()*550
    
temp._y Math.random()*400
    
temp.zielX Math.round(Math.random()*550); 
    
temp.zielY Math.round(Math.random()*400); 
    
temp.scaleXY Math.round(Math.random()*200+40);
    
temp.onEnterFrame mover

function 
mover() {
    
this._x += (this.zielX-this._x)/5
    
this._y += (this.zielY-this._y)/5
    if (
Math.round(this._x) == this.zielX) { 
        
this.zielX Math.round(Math.random()*550); 
        
this.zielY Math.round(Math.random()*400); 
    }
    
this._xscale += (this.scaleXY-this._xscale)/8;
    
this._yscale this._xscale;
    if (
Math.round(this._xscale) == this.scaleXY) { 
            
this.scaleXY Math.round(Math.random()*200+40);
            
trace(this._xscale);
    }

mfg
troner ist offline   Mit Zitat antworten
Alt 31-01-2006, 11:32   #9 (permalink)
Neuer User
 
Registriert seit: Jun 2002
Beiträge: 345
danke
habs von
http://www.creativecow.net/articles/...om_motion.html

und wollte das einfach mal nachmachen. das script ist genau dasselbe von ganz oben

tststs...
tausend Dank nochmal an alle
Gruss
flashmaus 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 05:59 Uhr.

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


Copyright ©1999 – 2012 Marc Thiele