Jump to content

How to flip weapon when player turns (2D Sidescroller)


callidus
 Share

Recommended Posts

 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

  • 2 weeks later...
 Share

  • Recently Browsing   0 members

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