Física en Flash: Movimiento parabólico
Estos era un día en las vacaciones del Gato que me dijo si me animaba a hacer un juego estilo "bowman", entre los dos; en flash.
Yo, otro que no tenia nada que hacer, le dije que sí. Hice esto, y se lo pasé para que continuara, pero:
Gato dijo: ******* (censurado)
Y ahí se quedó. Se lo pongo a Uds, mis visitantes favoritos, igual les es útil. ^^
Necesita tener Flash Player 7 o superior y JavaScript Activado. =)
El archivo Fla original, lo encontrarán aquí.
Actionscript:
-
var t:Number = 0;
-
var i:Number = 0;
-
g = -10;
-
Xox = 30;
-
Xoy = 300;
-
back.onPress = function() {
-
arkero.nextFrame;
-
arkero.play();
-
back.enabled = false;
-
Vox = (_xmouse/10);
-
Voy = ((400-_ymouse)/7);
-
angi = Math.atan(Vox/Voy);
-
p = _root.getNextHighestDepth();
-
attachMovie("flecha", "flecha"+i, p);
-
ref = _root["flecha"+i];
-
onEnterFrame = function () {
-
Aox = 0;
-
Aoy = +g;
-
//----------
-
Vx = Vox+Aox*t;
-
Vy = Voy+Aoy*t;
-
//----------
-
Xx = Xox+Vox*t+Aox*t*t/2;
-
Xy = Xoy-Voy*t-Aoy*t*t/2;
-
//----------
-
ang = Math.atan(Vx/Vy);
-
if (ang<0) {
-
ang += Math.PI;
-
}
-
ref._rotation = -angi*(180/Math.PI)+ang*(180/Math.PI)/2;
-
ref._x = Xx;
-
ref._y = Xy;
-
t += 0.1;
-
if (ref._y>350) {
-
p = _root.getNextHighestDepth();
-
arkero.gotoAndStop("rdy");
-
attachMovie("sangre", "sangre"+i, p);
-
_root["sangre"+i]._x = Xx;
-
_root["sangre"+i]._y = 350;
-
delete (onEnterFrame);
-
i++;
-
t = 0;
-
back.enabled = true;
-
}
-
};
-
};


DaHouseCat
May 5, 2007 | 8:00 PMaaaah nada como la censura ^^ trabaja!!! :latigo: ¬¬
Bleend
June 5, 2007 | 11:15 AMXD damn, tu me obligaste!
GoTiCo
June 1, 2008 | 6:01 PMInteresante tengo de trabajo hacer un GB (me gustaria comunicarme contigo)