Hello,
I’m trying to make ogmo levels work in my game but when I debug it i’m getting this error: [Fault] exception, information=TypeError: Error #1007: Instantiation attempted on a non-constructor.
This is my Level.as where I load the ogmo level(s).
package
{
import net.flashpunk.Entity;
import net.flashpunk.FP;
import net.flashpunk.World;
import net.flashpunk.Sfx;
import flash.utils.ByteArray;
public class Level extends Entity
{
[Embed(source = 'Level1.oel', mimeType = 'application/octet-stream')]
public static const LEVEL1:Class;
public static var levelarray:Array = [LEVEL1];
public static var current_level:Number = 1;
public function Level()
{
super()
loadlevel(levelarray[current_level]);
}
public static function loadlevel(map:Class):void
{
var xmL:XML = FP.getXML(map);
var o:XML;
for each (o in xmL.Objects.Player)
{
FP.world.add(new MyPlayer(o.@x, o.@y));
}
for each (o in xmL.Objects.Wall)
{
FP.world.add(new MyWall(o.@x, o.@y));
}
}
}
}