Zurück   Flashforum > Flash > ActionScript > ActionScript 1

Antwort
 
LinkBack Themen-Optionen Ansicht
Alt 16-04-2004, 13:13   #1 (permalink)
Ein_zelle
 
Registriert seit: Jul 2001
Ort: bochum
Beiträge: 214
im bogen ticken

hallo,

ich habe ein script welches eine kugel immer wieder aufticken lässt.
berührt sie den "boden" tickt sie senkrecht wieder in die höhe -
ich möchte aber eigentlich - das sie in einem bogen nach rechts tickt, und wenn sie dort auftickt wieder in einem bogen nach links zurück...

geht das - wenn wie?

MovieClip.prototype.upDown = function(pOben, pUnten, pY, pGravitation) {
this.vektor = pY;
this.gravitation = pGravitation;
this.onEnterFrame = function() {
this._y -= this.vektor;
if (this._y <= pOben) {
this._y = pOben;
this.vektor *= -1;
this.vektor1 *= -1;
} else if (this._y >= pUnten) {
this._y = pUnten;
}
this.vektor *= .96;
this.vektor -= this.gravitation;
};

};
kugel_mc.upDown(200, 400, 20, 2);


???
_drek
__________________
EndoplasmatischesReticulum
www.coded.de
dreck ist offline   Mit Zitat antworten
Alt 16-04-2004, 13:48   #2 (permalink)
wissbegierig
 
Registriert seit: Nov 2003
Ort: Hamburg
Beiträge: 206
Hi,

Für Kurven und Bogen Berechnungen solltest Du Sinus /Cos nehmen. Mußt mal hier im Forum suchen, da hatte ich irgendwo mal was entdeckt.
__________________
Gruß
PIXIX
PIXIX ist offline   Mit Zitat antworten
Alt 16-04-2004, 13:59   #3 (permalink)
.
 
Registriert seit: May 2003
Ort: bayern
Beiträge: 1.117
so in etwa?


var ySpeed = 10;
var xSpeed = 5;
var top = 0+ball._height/2;
var bottom = 400-ball._height/2;
var left = 0+ball._width/2;
var right = 200-ball._width/2;

MovieClip.prototype.upDown = function(pY,pX, pGravitation) {
this.vektor = pY;
this.gravitation = pGravitation;
this.onEnterFrame = function() {
oldY = this._y;
this._y -= this.vektor;
this._x += pX;
if (this._y <= top) {
this._y = top;
this.vektor *= -1;
} else if (this._y >= bottom) {
this._y = bottom;
this.vektor *= -1;
}
if (this._x <= left) {
this._x = left;
pX *= -1;
} else if (this._x >= right) {
this._x = right;
pX *= -1;
}
this.vektor *= .97;//.96;
pX *= .97;
this.vektor -= this.gravitation;
//onEnterFrame wird gelöscht
//wenn _y wert sich 5* hintereinander
//nicht geändert hat
if(this._y == oldY)count++;
else count = 0;
if(count>5){
this.onEnterFrame = null;
count = 0;
}
//
};
};
ball.upDown(ySpeed,xSpeed, 2);


greetings aus sonnigem bayern
mooseMash 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 15:45 Uhr.

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


Copyright ©1999 – 2012 Marc Thiele