arcanine Posted August 2, 2015 Share Posted August 2, 2015 if (cursors.right.isDown) { player.animations.play('left',15); player.x += 1; player.scale.x *=-1;}this is the code I have that triggers when the user pressed right on the keyboard my sprite sheet has a character that faces left and down, but I want to flip the left sprites horizontally to create a right facing character when I press right on the keyboard, the character faces left then right then left really quickly alternating between both directions why is this happening? Link to comment Share on other sites More sharing options...
Tom Atom Posted August 2, 2015 Share Posted August 2, 2015 It looks like you are changing direction on every frame ... (player.scale.x *= -1). Make some help variable like lookingRight = true/false and do test:if(!lookingRight) { player.scale.x *= -1; lookingRight = true;}or change player.scale.x *= -1; to player.scale.x = -1; tips4design 1 Link to comment Share on other sites More sharing options...
Recommended Posts