Citrus/Dragonbones Hero Initialization

51 views Asked by At

My hero object is being added to stage after i run the dragonbones armature.factory, but I'm attempting to check for hero position/collision in the update function. - only, the hero object is null until the initialize function is called and the hero is added to stage.

this is probably a super simple solution, but i'm trying to find a work around to check these on update.

var HeroX = hero.x;
var HeroY = hero.y;
1

There are 1 answers

0
James Waters On

I'm dumb. Super simple.

private var addHero:Boolean = false;   

//inside initialization 
addHero=true;


private function checkXY():void
    {
        HeroX = hero.x;
        HeroY = hero.y;

    }    

//in update
      if(addHero)
        {
            checkXY();
        }