Hi, I’m trying to add some enemies to my screen, this is what i did :
public class LineTrap extend Entity
{
//graphic
[Embed(source = "../../assets/images/trap/ball.png")]
protected static const LINETRAP_ART:Class;
protected var _lineTrap:Image;
public static var spaceBetween:Number = 10;
public LineTrap(x:Number, y:Number)
{
_lineTrap = new Image(LINETRAP_ART);
super(x, y, _lineTrap);
layer = 1;
type = "lineTrap";
}
//All your custom functions
public static function createHoritzontalLine(x:Number, y:Number, number:Number, world:World)
{
for(var i=0; i < number; i++)
{
world.add(new LineTrap(x + (spaceBetween+graphic.width)*i, y));
}
}
public static function createVerticalLine(x:Number, y:Number, number:Number, world:World)
{
for(var i=0; i < number; i++)
{
world.add(new LineTrap(x, y + (spaceBetween+graphic.height)*i));
}
}
}
This class adds a line of enemies on my stage just like this :
Now i want to create a group of enemies that gonna split after a while (or after a specific distance) just like this :
i’m thinking about the best way to do this !