June 2015
Beginner
354 pages
8h 23m
English
We are going to create a traditional Ping Pong game. There is a paddle on both the left and right sides of the playground. A ball is placed in the middle of the playground. Players can control the right paddle and move it up and down by using the mouse. We will focus on the mouse input and leave the ball movement for a later section:
pingpong directory.playground object inside the pingpong data object in the js/pingpong.js file. This stores variables that are related to playground:// data definition var pingpong = { paddleA: { x: 50, y: 100, width: 20, height: 70 }, paddleB: { x: 320, y: 100, width: 20, height: 70 }, playground: { offsetTop: $("#playground").offset().top, ...Read now
Unlock full access