/Java-Pong

Java program based on the game of Pong. The user controls a single paddle at the bottom of the screen to prevent a bouncing ball from getting past the paddle.

Primary LanguageJavaMIT LicenseMIT

Java Pong Game

Description

Simple Java Pong Game that uses Keyboard Controls
This Java program is NOT like the traditional version of pong that many individuals know. There is not a two-paddle system in this game. Instead, there is one blue paddle at the bottom of the screen that can slide across the bottom of the screen when the user hits certain keys on the computer keyboard. When the user hits the J key on the keyboard, the paddle will slide to the left. When the user hits the K key on the keyboard, the paddle will slide to the right. The goal of the game is to prevent a ball that is bouncing in a diagonal direction on the screen from getting past the paddle on the bottom of the screen. Each time the ball comes in contact with the paddle, it wil bounce off of the paddle and ricochet off different parts of the game window before making its way back down towards the bottom of the screen. Each time the user prevents the ball from getting past the paddle, that is counted as a "Bounce". The goal of the game is to get as many bounces as you can! Every five bounces, the speed of the moving ball will increase. The speed increase of the bouncing ball makes the game gradually more difficult. Keep in mind that if you reach a certain speed, the game may glitch. This happens when you reach a speed level of 18 or higher. The speed level is also tracked and shown on the upper lefthand corner of the game window. If the ball gets past the paddle at the bottom of the screen, a game over message will appear on the screen. The user can rerun the program to play the game again. The pong game in this repository was created as a project for my Software Design I (CS 120) class at the University of Wisconsin - La Crosse. I created my pong game using the Java programming language as well as an Integrated Development Environment (IDE) called Eclipse. In order to view this project, I would recommend installing the Eclipse IDE as well as Java if you do not already have these tools on your computer. If you wish simply to view the code, a simple text editor can be used.

Picture of a the Java Pong Game Window

javapong

 

Resources for Project:

  • Java
  • Eclipse (IDE)

Running / Viewing the Project

Eclipse (IDE)

  1. First, make sure that you have the Eclipse IDE to run the program. If you need to download Eclipse, the link is provided below.
    -Eclipse (IDE) Download: https://www.eclipse.org/downloads/
  2. Next, make sure that you have Java installed in your system. Go to your settings/system preferences and search for Java in your system. If you do not already have Java installed, follow the link below. The link will bring you to a website for downloading Java. The website will give you the option to download Java for Mac or Windows.
    -Java Download: https://java.com/en/download/help/download_options.html
  3. On this repository page, go to the "Code" button and click the "Download Zip" option.
  4. Go to your "Downloads" section on your computer and place the zip file in a folder/location other than "Downloads".
  5. Double click on the zip file to open or "unzip" it so you can access the file contents.
  6. Open up Eclipse, and type "Java-Pong-Game" as the name of the workspace. Then click the "launch" button.
  7. If any settings options appear, click the "Hide" option located in the upper righthand corner of the screen.
  8. You should now see a workspace. You will probably NOT see any files. To get the actual file content into the workspace, click on the "Import projects" option.
  9. Click the "General" dropdown arrow option. Then double click "Projects from Folder or Archive". This should open a separate Eclipse window.
  10. In the separate Eclipse window, select the "Directory..." button. This should open your file system window. In the file system window, navigate to the location where the "Java-Pong-master" folder is stored.
  11. Select the "Java-Pong-master" folder. Click "Open". This will add the path the the directory in the separate Eclipse window you have opened.
  12. Then in the separate Eclipse window, click "Finish".
  13. Open the project folder that should now be in your workspace by double clicking it. Then open the "src" folder by double clicking it, and then open the "(default package)" folder by double clicking it.
  14. Next, open the "Driver.java" file by clicking it. Hit the green run icon, which is a green circle with a white triangle inside of it. The program should run, and you should see a separate window open with the Java Pong Game running on it.
  15. Below, see the Java Pong Game Controls so that you know how to play the game.

Java Pong Game Controls

  1. To move the paddle to the left, hit the J key on your computer keyboard.
  2. To move the paddle to the right, hit the K key on your computer keyboard.

 

@Author: Andrew Krause
LinkedIn: https://www.linkedin.com/in/andrew-krause-b6aa21179/
Portfolio: https://andrewkrause.dev/
Instagram: https://www.instagram.com/aek.krause/
Facebook: https://www.facebook.com/andrew.krause.35325