Carrying on from the Gravity tutorial it's time to make things jump!
William Clarkson, over at PhaserGames, writes: "In last week’s post, we explored how to use gravity in Phaser 3. Now we will defy that gravity and make the ball jump. We can do this by setting the velocity of the ball to counteract the gravity.
So far in the code, we’ve set up a ball that falls until it collides against a platform. In this example, we will make the ball jump whenever the game is clicked. Let’s add some input detection at the end of the create function".
Learn to code and lead your intrepid crew on a mission to save The Cloud in TwilioQuest, a PC role-playing game inspired by classics of the 16-bit era. Free forever, and available now for Windows, Mac, and Linux.
The first book on the creation of HTML5 cross platform games using Phaser 3 and other free software.
- By Emanuele Feronato
- 155 Pages
- 28 Source Code Examples
- Build a complete game from start to finish
- Cross Platform
- Scaling for devices