So instead of using static variables, like I’ve always done, now I’m trying to change the habit.
I’m trying to access my world’s variables in an enemy, so I can change the skin of the enemy depending on what type of level is active.
I’ve tried this
var gameworld:GameWorld = GameWorld
if (gameworld.isNormalLevel) spritemap = new Spritemap(NORMAL, 30, 20);
if (gameworld.isGreenLevel) spritemap = new Spritemap(GREEN, 30, 20);
as you can see, I can access the variables just fine (isNormalLevel and isGreenlevel are both variables in the world file), but I get this stupid error:
Implicit coercion of a value of type Class to an unrelated type game:GameWorld.
I know the answer is probably ridiculously stupid easy, but since I’m worthless I don’t know it. Please help, thanks I googled this and found solutions to accessing entities with names, but I can’t seem to give my world a name…