Hi everyone,
While it seems that i could correctly use an instance of my Player in another class to access his properties, i’m now facing a problem when using world.getInstance() in another Class.
private function join_world_tab() : void
{
if (_player_instance == null)
_player_instance = world.getInstance("player") as Player;
else
_player_instance.add_new_world_entity(this);
}
_player instance is declared like this, in a Class called Content :
private var _player_instance : Player;
I got an error message saying that i can’t acess a null property, the problem is that a similar portion of code works properly elsewhere, like this :
if (collide("player", x, y))
{
if (_player_instance == null)
{
_player_instance = world.getInstance("player") as Player;
}
else
{
this._player_instance.setOnFloor(true);
}
Anybody knows what is going on ? I’m kinda lost here. Thanks !