Jump to content

I must've screwing something up with AddChild?


Recommended Posts

I'm trying to make an enemy have a hit all around himself, so that he can use a suicide explosion attack if the player gets too close. I decided the best way to do it was to create another, bigger sprite around him, then add it as a child so it follows him around, and check if it overlaps with the player.


Only as soon as I add it as a child, it disappears. Debugging it's body returns nothing, and it doesn't seem to have an x or y coordinates at all.


The code so far was

_explosionArea = this.game.add.sprite(_posix,_posiy,'bomb')bombEnemy.addChild(_explosionArea);_explosionArea.anchor.setTo(0.5, 0.5);_explosionArea.scale.setTo(2.75, 2.75)this.game.physics.arcade.enable(_explosionArea)_explosionArea.enableBody = true;			
Link to comment
Share on other sites


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...