A starter project for a basic pong game using SVGs.
Ensure you have Node.js installed first.
Install dependencies:
$ npm install
Run locally with the Parcel dev server:
$ npm start
Once you run the start command you can access your project at http://localhost:3000.
Read more about the Parcel web application bundler here.
- Up :
a
- Down :
z
- Up :
▲ (Up key)
- Down :
▼ (Down key)
Special keys during the game play ::
- (Last ball only) Speed up :
f
- (Last ball only) Speed down :
v
- (Last ball only) Expand the size :
g
- (Last ball only) Shrink the size :
b
- Add a ball :
h
- Subtract a ball :
n
General keys ::
- Left :
◀︎ (Left key)
- Right :
▶ (Right key)
- Select or return :
Enter
- Pause :
Space
-
Single player
- This play mode is not available.
-
Multi-players
- 2 players compete each other.
- Use
a
,z
keys for player 1 and▲
,▼
keys for player 2.
-
Player 1 is
Red
and plyaer 2 isCyan
. -
The ball will move in 30fps after game begins.
This time can be modified in the file settings.js (
./src/images/setting.js
) and the property(intervalGameTime: 30
). -
The other player's paddle shrinks by
8
points if ball is hit.The paddle shrinks until the height is
16
point long. -
Use special keys
f
,v
,g
,b
for more dynamic play.
-
Either of players scores 10 wins the game.
This number can be modified in the file settings.js (
./src/images/setting.js
) and the property(winningScore: 10
).
The deployment workflow for this project will be a bit different from what you've used when deploying simple static websites.
To deploy your finished Pong project as a GitHub page, you must first update the predeploy
script in the package.json
file with the name of your repo.
For example, if your repo URL is:
https://github.com/bob/pong-project
Update the predeploy
script as follows:
"predeploy": "rm -rf src && parcel build index.html --public-url /pong-project",
Once you have done this, you can run:
$ npm run deploy
Now check out your deployed site 🙂
-
Structural code is open-sourced under the MIT license.
-
Learning materials content is copyright (c) 2019 RED Academy.
<3