I wanna know how to invert my game character when he turns around to the left and right when walking
1 Like
Programmatically just do:
this.scaleX *= -1;
3 Likes
Great suggestion @Jovanny.
There’s a few ways to do this, but the full code for this could be something like:
if (key === 'left') {
this.scaleX = -1; // Flip Left
this.x -= 1; // Move Character left
} (key === 'right') {
this.scaleX = 1; // Flip Right
this.x += 1; // Move Character Right
}
2 Likes