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...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

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