November 2022
Beginner
368 pages
6h 47m
English

In the previous chapter, we got started building our first game, Bounce!, by creating a canvas and adding a bouncing ball to our code. Right now, our ball will bounce around the screen forever, which doesn’t make for much of a game. In this chapter, we’ll add a paddle for the player to use. We’ll also add an element of chance to the game, which will make it more challenging and fun to play.
There’s not much fun to be had with a bouncing ball when there’s nothing to hit it with. So let’s create a paddle!
We begin by adding the following code directly after the Ball class to create a paddle ...