ERLEDIGT
NEIN
NEIN
ANTWORTEN
0
0
ZUGRIFFE
3852
3852
EMPFEHLEN
-
29.03.03 00:01 #1
Hi Folks,
Hier zwei Funktionen zum bearbeiten und zerpflücken:
Code :1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
function setGravity(obj,pLinks,pRechts,pOben,pUnten,pX,pY,pGravitation) { this[obj].feld = {links:pLinks, rechts:pRechts, oben:pOben, unten:pUnten}; this[obj].vektor = [pX, pY]; this[obj].gravitation = pGravitation; this[obj].onEnterFrame = function() { this._x += this.vektor[0]; this._y -= this.vektor[1]; if (this._x <= this.feld.links) { this._x = this.feld.links; this.vektor[0] *= -1; } else if (this._x >= this.feld.rechts) { this._x = this.feld.rechts; this.vektor[0] *= -1; } if (this._y <= this.feld.oben) { this._y = this.feld.oben; this.vektor[1] *= -1; } else if (this._y >= this.feld.unten) { this._y = this.feld.unten; this.vektor[1] *= -1; } this.vektor[0] *= .96; this.vektor[1] *= .96; this.vektor[1] -= this.gravitation; }; this[obj].onPress = function() { this.vektor = [-this._xmouse * 2, this._ymouse * 2.5]; }; } setGravity("kugel_mc",40,260,40,260,0,0,2); setGravity("kugel_mc2",40,260,40,260,0,0,4); setGravity("kugel_mc3",40,500,40,260,0,0,4);
Beispiel:
http://www.flashangel.de/mx/fsgravity2.swf
Code :1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
function setWurf(obj,pLinks,pRechts,pOben,pUnten,pX,pY,pGravitation) { this[obj].feld = {links:pLinks, rechts:pRechts, oben:pOben, unten:pUnten}; this[obj].vektor = [pX, pY]; this[obj].gravitation = pGravitation; this[obj].onEnterFrame = function() { if (this.ziehen) { this._x = this._parent._xmouse; this._y = this._parent._ymouse; this.letztePos = this.aktPos; this.aktPos = [this._x, this._y]; this.ziehVektor = [this.aktPos[0] - this.letztePos[0], this.letztePos[1] - this.aktPos[1]]; } else { this._x += this.vektor[0]; this._y -= this.vektor[1]; if (this._x <= this.feld.links) { this._x = this.feld.links; this.vektor[0] *= -1; } else if (this._x >= this.feld.rechts) { this._x = this.feld.rechts; this.vektor[0] *= -1; } if (this._y <= this.feld.oben) { this._y = this.feld.oben; this.vektor[1] *= -1; } else if (this._y >= this.feld.unten) { this._y = this.feld.unten; this.vektor[1] *= -1; } this.vektor[0] *= .96; this.vektor[1] *= .96; this.vektor[1] -= this.gravitation; } }; this[obj].onPress = function() { this.aktPos = [this._x, this._y]; this.ziehen = true; }; this[obj].onRelease = this[obj].onReleaseOutside = function () { this.ziehen = false; this.vektor = this.ziehVektor; }; } setWurf("kugel_mc",40,260,40,260,0,0,4); setWurf("kugel_mc2",40,400,40,260,0,0,3); setWurf("kugel_mc3",40,500,40,260,0,0,2);
Beispiel:
http://www.flashangel.de/mx/fswerfen2.swf
Hinweis: Nicht wundern auch das kam bei einer längeren Bahnfahrt zustande wollte ich Euch nicht vorenthalten.
Achtung: Dort wo die Smilies im Code sind bitte durch einen Doppelpunkt ersetzen.
Liebe Grüsse
Matze K.FlashStar:
http://www.flashstar.de
[Flash Experimentals - News - Links]
Flashpower:
http://www.flashpower.de
[Flash Portal - Prototypes]
ActionScript Praxis:
http://www.actionscript-praxis.de
[Buchinfo - Ergänzungen - Zusatz Material]
Bücher zu Flash 8 und CS3:
HotStuff Buch -=- Professional Series Buch -=- Flash CS3 Powerworkshops
Ähnliche Themen
-
Gravitation und Kamera
Von Soulhunta im Forum Cinema 4DAntworten: 1Letzter Beitrag: 21.12.04, 18:39 -
Gravitation simulieren?
Von MoonCrow im Forum Cinema 4DAntworten: 4Letzter Beitrag: 26.10.04, 16:51 -
gravitation?
Von sente im Forum Cinema 4DAntworten: 1Letzter Beitrag: 14.09.04, 20:42 -
gravitation ? was mache ich falsch
Von marcel-berlin im Forum Cinema 4DAntworten: 6Letzter Beitrag: 12.03.04, 23:19 -
Habe ein Problem mit Gravitation
Von GreenRanger im Forum Cinema 4DAntworten: 3Letzter Beitrag: 27.02.04, 16:09





Login





