- Full unity projects are difficult to push to github due to file size constraints, so this repository contains the C# scripts for the game objects in a simple pong game.
- The game starts on the opponent's turn.
- The player can be controlled with arrow keys.
- When either the player or the opponent scores, the scoreboard will be updated by one point.
- ballScript.cs handles the ball's motion and bounces using a rigidbody (myRigidBody) and a vector (direction) to represent its collision behavior and direction.
- logicScript.cs handles the scoreboard of the game, as well as the resetting of the player, opponent, and the ball's position and direction upon each score.
- PT_script.cs (player trigger) and OT_script.cs (opponent trigger) handle the Trigger2D game objects that help determine when the ball goes into either the player's or opponent's goal.
- opponentScript.cs handles the opponent's behavior and movement. In its simplest form, the opponent will trace the ball's y position, though do so with very slow movement.
- playerScript.cs handles the player's movement, also ensuring that it stays within the boundaries of the game board.
-
When the game is first started, the board will look like this.
-
When either side scores (in this case, the opponent), the scoreboard will be updated as shown (the opponent scored twice).
- Nicholas Golparvar