callidus Posted May 13, 2020 Share Posted May 13, 2020 knight = game.add.sprite(game.width/2,game.height-175,'knight'); game.physics.enable(knight, Phaser.Physics.ARCADE); knight.body.collideWorldBounds = true; weapon = knight.addChild(game.make.sprite(15, -15, 'greatsword')); //weapon.anchor.setTo(1,1) Knight is my player, and he holds a sword that I implemented as a child of the knight. My issue is that it follows the player but doesn't flip when he turns. I tried to set the weapon as an anchor but I get an error "Cannot read property 'anchor' of undefined". Thanks for any help Link to comment Share on other sites More sharing options...
Mangonion.Game.Dev(); Posted May 22, 2020 Share Posted May 22, 2020 Anchor isn't a part of phaser 3, I had the same issue. the way you have to do it now is: weapon.setOrigin(origingoeshere); if you want the origin to be in the center all you have to do is set the origin to 0.5. You can play around with the value until you get the desired result. Hope this helps! Link to comment Share on other sites More sharing options...
Recommended Posts