swift - Positioning SkSpriteNode inside SkAction completion handler -


i have run strange issue. adding enemy(skspritenode) inside gamescene didmove(to view: skview) using addchild.

enemy has been positioned x:100, y: 100 , appears correctly. have animation , completion of adding enemy @ same location . enemy appears @ different location.the completion block shown below.

    holeexplosion.runholeexplosionaction {[unowned self] in         //self.addenemy(enemycount: 1, hole: holeexplosion)         var modenemy: parentenemy? = nil         modenemy = enemy1(imagenamed: "zombie1jump1.png", healthpower:30)          print(" \(self.scene?.position.x)  \(self.scene?.parent) ")         self.addchild(modenemy!)         modenemy!.enemyspeed = self.enemy1speed         modenemy!.name = "enemy1"          modenemy!.position = cgpoint (x: 100 , y: 100)         modenemy!.zposition = 2     } 

any appreciated. thanks.

your enemy class have physicsbody delegate?? maybe can see first because if has it, have search isdynamic property. can't have 2 bodies in same space when property equal true.


Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -