Giter Site home page Giter Site logo

cs56-games-pong's Introduction

Pong

This is an implementation of the classic game Pong, with cooperative multiplayer support.

To compile and run: "ant run" in the main directory

There are seven game mode options that correspond to the size of the window when playing.

How To Play: Player 1 (on the left) "W" -- Move up "S" -- Move down "a" -- grab ball (hold to grab)

Player 2 (on the right) up arrow -- Move up down arrow -- Move down left arrow -- grab ball (hold to grab)

Instructions: When the ball is stopped, Press the spacebar to activate motion. Try to not let the ball hit your side of the screen or you will lose a life. The player who wins the round, receives the total number of hits added to their score. Each Player has 3 lives. The Winner is whoever has the most lives at the end, their name will be prompted. If their score is in the top 5 of the High Score, then it will be saved to the High Score.

TODO: maybe add a few more tickets, most of the existing ones wouldn't take much time to implement. Other than that it builds and runs fine (David Coffill)

project history(Newest remarks to oldest)

Fall 2017 final remarks

F17 Andrew Polk, Victoria Sneddon, 2PM lab

  • What the code does:
    • allows users to choose which mode of the game "pong" they want to play and the colors of the ball and paddles
  • Features to be added:
    • AI opponent
    • Change y ball velocity when ball hits paddle
  • Bugs:
    • issues with screen size for some of the modes
    • ball can get stuck behind paddle and wall collisions
    • pause text doesn't automatically show up always
  • Opportunities for Refactoring:
    • code can still be better organized, neater
  • Advice:
    • program for extensible
    • think about the poor future students that will have to fix your code

Winter 2016 final remarks

W16: Angel Ortega, Ben Patient, 4PM lab

  • What the code does:
    • The code is a simple game of Pong for two players, with scores.
  • Features that could be added:
    • AI for the paddle
    • Multiple ball modes
    • Unit-tests
  • What bugs exist:
    • Pausing does not pause the paddles
  • Opportunities for refactoring:
    • Make variables private, prefer to use nonstatic variables
    • Remove coupling
    • Consider builder pattern for GUI creation

Fall 2016 final remarks

TODO:

  • Add instructions for the ball grabbing feature, we implemented it so that holding "a" when the ball is within close range of the left paddle grabs the balls, and "left arrow" grabs the balls when they are in range of the right paddle.

  • Fix the ball colliding with the top/bottom wall when grabbing the ball with paddle (play around with this and you will clearly see the issue)

  • Fix how the game recognizes pausing when the ball is attached

  • Integrate two balls with all the difficulty modes and extra balls

How To Play: Player 1 (on the left) "W" -- Move up "S" -- Move down "a" -- grab ball (hold to grab)

Player 2 (on the right) up arrow -- Move up down arrow -- Move down left arrow -- grab ball (hold to grab) SUGGESTIONS Integrate grab paddle with thread so that it when the user presses either "a" or "left arrow", the game processes it right as the ball and paddle collide. (right now we are using distance which allows you to grab the ball while it isn't touching the paddle) Refactor how the two balls is implemented so that multiple balls will be easier to work with (in the code)

Winter 2014 remarks

 W14 | bronhuston 4pm | sarahdarwiche,benjaminhartl | An implementation of the classic game Pong, with cooperative multiplayer support.

An implementation of the classic game Pong, with cooperative multiplayer support.

To Compile and Run: "ant run" in the main directory

The three difficulty options correspond to the size of the window when playing.

How To Play: Player 1 (on the left) "W" -- Move up "S" -- Move down

Player 2 (on the right) up arrow -- Move up down arrow -- Move down

When the ball is stopped, Press the spacebar to activate motion. Try to not let the ball hit your side of the screen or you will lose a life. The player who wins the round, receives the total number of hits added to their score. Each Player has 3 lives. The Winner is whoever has the most lives at the end, their name will be prompted. If their score is in the top 5 of the High Score, then it will be saved to the High Score.

cs56-games-pong's People

Contributors

benjaminhartl avatar bkhanijau avatar brianslee avatar bronhuston avatar dcoffill avatar gonfunko avatar hannavigil avatar iamsamuelfu avatar jdum66 avatar joelbagan avatar joyoyoyoyoyo avatar kjorg50 avatar lingampalli56 avatar mastergberry avatar millanbatra1234 avatar pconrad avatar sanchitg94 avatar vsneddon avatar xingxinggeng avatar zhanchengqian avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

cs56-games-pong's Issues

Encapsulate variables and use getters & setters

No encapsulation is being used in this project.
Almost every variable is public. Getters and setters could be used instead.

This does not enforce separation of concerns.
Example code:

        game.b.draw(g);
        game.p1.draw(g);
        game.p2.draw(g);

fix labels in class diagram in README

In the class diagram in the README file, the label for dashed lines says "Creates an instance of" and the label for solid lines says "is a Subclass of", but these should be reversed.

The rest of the information is correct, so this is a low-priority fix.

~estimated 20

High score feature crashes

High score saving crashes when writing and viewing the highscores at the start and end of game.
This could be fixed.

Add new instructions based on new features added.

A couple new features were added from the old pong version. First, there's a new grab ball feature, when the ball is close enough to a paddle pressing a or the left arrow key (left and right users respectively) will "stick" the ball to the wall. Additionally, a new game mode with 2 balls has been added. Also could add somethings detailing changes between difficulty level (paddle size, starting ball speed, starting ball size, and window size)

100 pts

Add Features

We want to add features such as a color chooser for the paddle, remove the extra paddle, an option for the speed of the ball, and fix up the GUI for the leaderboard, etc.

Comments in javadoc format

There are many good comments in this project; however in many cases they are only comments that use the single line // format. Refactor these to use javadoc comments with appropriate annotations such as @author, @version and @see for class-level javadocs and @param and others for method-level javadocs. This is a good way to become familiar with the code for new developers on this project.

~estimated 100

#18 Create Class Diagram

Created a Class Diagram that accurately represents the collaboration between the separate classes. It shows the Class names and the object names that were created for each class. This allows the next programmers to easily understand how the classes are related. The reason we created this was because we struggled ourselves going through the classes to find their relationships.
We also added a new screen shot to display what the current game looks like when it is run.
We put this in the README file so that it would appear on the cs56-games-pong main repository page.

Add Junit tests

Add additional Junit tests to the existing test cases.

~estimated 100

Bug: Fix how the game recognizes pausing

With the new grab ball feature, when the game recognizes that the ball is in range and can be grabbed, the ball's X and Y velocity are set to 0. The pause works by looking at when the ball's velocity X and Y are 0. This has a bandage fix right now checking if the ball is "attached" to the paddle, but occasionally this will bug out especially when the paddle hits the wall (see issue #70 )

150 pts

Chore: Use updated AudioPlayer because it will be deprecated

The internal proprietary API may be removed in the future.

Java-compiling is giving deprecation warnings. Use the recommended Java API audio player for all audio playing instances.

Here is the warning message:

    [javac] Compiling 8 source files to /fs/student/{USERNAME}/courses/cs56/cs56-games-pong/build
    [javac] /fs/student/{USERNAME}/courses/cs56/cs56-games-pong/src/edu/ucsb/cs56/projects/games/pong/gameplay/Pong.java:3: warning: AudioPlayer is internal proprietary API and may be removed in a future release
    [javac] import sun.audio.AudioPlayer;
    [javac]                 ^

Bug: Potential lag from audio collision

Bug: Sometimes lag is experienced in game when audio collision happens

Note: If no lag is experienced, this may be a time drainer and waste of time. Problem only occurs sometimes.

If lag is experienced in audio collision then prevent this lag.
Use OOP principles to ensure optimization, no memory leaks, and DRY behavior.

Adjust the window where the user can grab the ball

Currently, the window for grabbing the ball with a or left arrow key is huge (you can grab the ball before it even touches the paddle). A readjustment of the window a user has to grab the ball is needed.

150-200 pts

Add Extreme Mode

Include a mode where you do not know where the ball will bounce.

Improve High Score Handling

Depends on #10
Currently, the high menu pops up in the corner of the screen when the player loses the game, but there is no other way to access the high scores.

First, make the high score entering more aesthetically pleasing and change how the scores are entered so that the prompt window isn't in the upper corner.

Second, have add an option on the Menu/Start Screen to view the high scores.

~estimated 300

Fix High Scores

Fix the High Scores so that the game displays the High Scores and adds a new High Score when a player gets a Top 5 score.

Make Two Balls A Fully Customizable Game Mode

As of now we have one game mode that allows for two balls and multiple game modes for a specific difficulty. Find a way to make it so that game mode two balls, which can be renamed to "Customizable Game Mode" includes any of the difficulty levels we implemented as well as any number of balls between one and 5(after that the game might get unplayable or the balls might not fit on the screen)
200-300pts

#17 Add Comments

Before we got this code, the comments were mostly incorrect and many of the methods were never even used. We updated the comments and used more accurate method and variable names.

Grabbing ball and colliding with wall

Ball shifts up/down on paddle (depending on upper or lower wall collision while being held to paddle) thus changing ball's position on paddle. If ball is held and user continuously hits top and bottom wall, ball is eventually vertically separated from the paddle while still being held. Though game is still entirely functional, this creates minor glitches when ball makes contact with top or bottom wall while seperated from paddle.

100-200pts

Some changes to paddles

Paddle size is static between all difficulty levels. Could change paddle size based on difficulty chosen. Also paddle position isn't always centered. It's centered for super-easy but begins to get shifted slowly upwards as the window size changes (due to difficulty changes)

Changing Ball Speed

Minimum ball speed seems to be always be static no matter the difficulty or how the player hits the ball. Could add a different minimum ball speed for different difficulty levels to make it harder.

#16 Rewrote a read and write to file

The previous code that we were given did not work correctly. It would not save the points from the previous games but would set the names to null and the score to 0. It would also not put any score for the user that had just won. It was all implemented in the same ActionListener, which was all in the same try statement, which was all nested in the same method. We wrote it in an object oriented manner with low coupling and high cohesion. We opened a new window after the game which asks for the winning user to implement their name. It then will search the file to determine if it will make the high scores list that is saved. Then it displays all the high scores in the correct order. It also has a link back to the main menu to play again.

Add multiplayer functionality

Currently, there are 2 paddles, one controlled by W/S and one by the arrow keys.

Add a new level option where the Two players actually play against each other.

~estimated 360

Add Menu Screen

Instead of having an initial window pop up asking for the user to choose a difficulty level, add a menu/start screen.

The Menu should at least include the difficulty settings, instructions on controls, and a play button.

~estimated 320

Refactor paddles

Currently, the paddles are instances of Paddle and PaddleRight. You'll notice that these classes are almost exactly the same. Refactor the project so that only one Paddle class exists, and make any necessary changes to other classes to support playing the game with this single class.

~value 100

Order highscore list by top score

Highscores should be ordered by top scores.

After loading the CSV file and writing the new highscore, order the highscores by TOP highscore as priority. This should be done before HighScore GUI creation

Requires implementing the Comparable method for HighScore object.

Add high scores

Rather than having the user win once they reach 10 points, modify the game to go on indefinitely until the user misses some number of balls. When this happens, ask for their name, and write that and the current score to a file. Also add a leaderboard window that displays the 5 or 10 highest scores and player names.

~value 300

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.