![Antiguo](http://static.forosdelweb.com/fdwtheme/images/statusicon/post_old.gif)
06/11/2005, 20:09
|
![Avatar de TMeister](http://static.forosdelweb.com/customavatars/avatar14341_6.gif) | Crazy Coder | | Fecha de Ingreso: enero-2002 Ubicación: En la Oficina
Mensajes: 2.880
Antigüedad: 23 años, 1 mes Puntos: 193 | |
Comenzamos.
Flash MX 2004 o Flash 8
36 Frames * Segundo
Código:
//Teclas de Accion
//izquierda, Derecha, Barra Espaciadora
var shot:MovieClip;
var sizeShot:Number = 10;
var lis:Object = {};
var count:Number;
function init() {
Stage.scaleMode = "noScale";
count = 5;
shot = drawTri(sizeShot, 0x990000);
shot._y = Stage.height-sizeShot;
Key.addListener(lis);
lis.onKeyDown = doAction;
}
function doAction() {
switch (Key.getCode()) {
case (37) :
shot._x -= 5;
break;
case (39) :
shot._x += 5;
break;
case (32) :
doBullet();
break;
}
}
function doBullet() {
var tiro = this.createEmptyMovieClip("a"+count++, count++, {_x:shot._x, _y:shot._y});
tiro.moveTo(shot._x, shot._y);
tiro.lineStyle(0);
tiro.lineTo(shot._x, shot._y);
tiro.lineTo(shot._x, (shot._y-10));
tiro.onEnterFrame = moveShot;
}
function moveShot() {
if (this._alpha > 0) {
this._y -= 10;
this._alpha -= 1
} else {
this.removeMovieClip();
}
}
function drawTri(size:Number, color:Number) {
var shot:MovieClip = this.createEmptyMovieClip("shot", 2);
shot.lineStyle(1, color);
shot.beginFill(color);
shot.moveTo(0, size);
shot.lineTo(0, size);
shot.lineTo(size, size);
shot.lineTo((size/2), 0);
shot.lineTo(0, size);
return shot;
}
init();
|