Welcome to Pong! This is a classic arcade game where players control paddles to hit a ball back and forth. The objective is to score points by making the ball pass the opponent's paddle.
- Single Player vs. CPU: You can choose to play against a computer opponent with two difficulty modes: easy and hard.
- Multiplayer: Play against a friend on the same computer, with one player using the mouse and the other using the keyboard.
This section will guide you through configuring and running the Pong game with your desired game mode.
Clone this repository on your computer:
$ git clone https://github.com/DelicaTessa/Java-Pong
- To play against the CPU, follow these steps:
- Open your Integrated Development Environment (IDE).
- Locate the
Game.java
file in thesrc
folder. - Look for line 11, which reads:
Pong content = new Pong(Player.KEYBOARD, Player.CPU_EASY);
- Replace the first parameter with either
CPU.EASY
orCPU.HARD
depending on your desired CPU difficulty level. - For the second parameter, choose either
Player.MOUSE
orPlayer.KEYBOARD
based on whether you want to control your paddle using the mouse or keyboard.
- To play a multiplayer game, follow these steps:
- Open your Integrated Development Environment (IDE).
- Locate the
Game.java
file in thesrc
folder. - Look for line 11, which reads:
Pong content = new Pong(Player.KEYBOARD, Player.CPU_EASY);
- Set the first parameter to
Player.MOUSE
. - Set the second parameter to
Player.KEYBOARD
.
- After configuring the game mode, follow these steps to compile and run the game:
-
Compile the Game:
-
In your IDE, make sure all source files, including
Game.java
, are saved. -
Open your terminal or command prompt.
-
Navigate to the directory containing the game source files.
-
Use the
javac
command to compile the game:javac *.java
-
This command will compile the Java source code.
-
-
Run the Game:
-
After successful compilation, run the game using the
java
command:java Main
-
The game will start based on the game mode configuration you specified.
-
- Have fun playing Pong with your preferred game mode setup!