rendered paste bodyvar bulleta:bullet = new bullet(targetPointn, startX, startY,level.width,level.height,myTeam)
bulletGroup.add(bulleta);
bulleta.color = Math.random() * 0xfffffff;
/// bullet class:
package
{
import flash.display.Shape;
import flash.geom.Rectangle;
import org.flixel.FlxSprite
import org.flixel.*;
/**
* ...
* @author
*/
public class bullet extends FlxSprite
{
public var team = 0;
public var timer = 20;
public function bullet(targetPoint, startX, startY,levelx,levely,team)
{
redraw(targetPoint, startX, startY ,levelx,levely,team);
}
public function redraw(targetPoint, startX, startY,levelx,levely,team)
{
this.timer = 35;
var drawShape = new Shape();
// this.width = 1000;
// this.height = 1000;
this.makeGraphic(levelx,levely, 0xff0000);
// var color = Math.random() * 0xff333333;
var color = 0xfffffff;
drawShape.cacheAsBitmap = false;
drawShape.graphics.lineStyle(1, color, 1);
drawShape.graphics.moveTo(startX, startY);
drawShape.graphics.lineTo(targetPoint.x, targetPoint.y);
// drawShape.graphics.beginFill(0xff666666, 0.6);
this._pixels.draw(drawShape)
this.x = 0;
this.y = 0;
this.alpha = 0.4;
if (team == 0) { this.color = 0xffFF5151; } else { this.color = 0xff25ABDE; }
}
}
}