I am creating an endless running styled game but i cant seem to understand how to add any randomly generated barriers. As it stands I have been doing this four times package { import net.flashpunk.Entity; import net.flashpunk.FP; import net.flashpunk.Graphic; import net.flashpunk.Mask; import net.flashpunk.graphics.Image;
public class wall extends Entity
{
[Embed(source="post.png")] public const POST:Class;
public function wall()
{
graphic = new Image(POST)
y = 400;
x = 800;
setHitboxTo(graphic)
type = "Wall";
}
override public function update():void
{
//move the position to the bottom
x = x -5;
if (x < 0){
//remove from the world
world.remove(this);
}
}
}
} Does anyone know how i can have these as randomly generated? Thanks!