![Antiguo](http://static.forosdelweb.com/fdwtheme/images/statusicon/post_old.gif)
12/11/2005, 11:06
|
![Avatar de eldervaz](http://static.forosdelweb.com/customavatars/avatar38143_0.gif) | | | Fecha de Ingreso: agosto-2003 Ubicación: lima
Mensajes: 551
Antigüedad: 21 años, 6 meses Puntos: 0 | |
aqui va mi aporte
Código:
//Teclas de Accion:
//Mouse y click
var shot:MovieClip;
var sizeShot:Number = 10;
var lis:Object = {};
var count:Number;
function init() {
mostritos();
Stage.scaleMode = "noScale";
count = 5;
shot = drawTri(sizeShot, 0x990000);
shot._y = Stage.height-sizeShot;
var mouse:Object = new Object();
mouse.onMouseDown = function() {
doBullet();
};
Mouse.addListener(mouse);
}
_root.onEnterFrame = function() {
shot._x = _root._xmouse;
};
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;
}
function mostritos() {
var todos:MovieClip = this.createEmptyMovieClip("todos", this.getNextHighestDepth());
var bot:MovieClip = todos.createEmptyMovieClip("bot", this.getNextHighestDepth());
todos.bot.beginFill(0xcccccc, 100);
todos.bot.moveTo(0, 0);
todos.bot.lineTo(25, 0);
todos.bot.lineTo(25, 20);
todos.bot.lineTo(20, 20);
todos.bot.lineTo(20, 10);
todos.bot.lineTo(15, 10);
todos.bot.lineTo(15, 20);
todos.bot.lineTo(10, 20);
todos.bot.lineTo(10, 10);
todos.bot.lineTo(5, 10);
todos.bot.lineTo(5, 20);
todos.bot.lineTo(0, 20);
todos.bot.lineTo(0, 0);
todos.bot.endFill();
//
for (var i = 0; i<10; i++) {
todos.bot.duplicateMovieClip("clip"+i, 10+i);
bot = todos["clip"+i];
bot._x = 50*i;
}
//
var loop:MovieClip = this.createEmptyMovieClip("loop", this.getNextHighestDepth());
dirx = 5;
diry = 0;
loop.onEnterFrame = function() {
todos._x += dirx;
if (todos._x>50) {
dirx = -5;
todos._y += 10;
}
if (todos._x<0) {
dirx = 5;
todos._y += 10;
}
};
}
init();
|