How to flip the player to look in walking direction in WoofJS
2D Game Design with WoofJS
🕑 This lesson will take about 10 minutes
In this lesson, you will learn how to flip a player sprite to look in each direction when walking left or right in WoofJS, as shown in the example below. To achieve this, we just change the player costume by specifying a different URL (link) for the image. This means you will need two version of the player sprite - one looking left and one looking right.
Create a new project at woofjs.com and use the following code to implement this feature. Make sure you pay attention to the comments in the code that explain how it works.