Giter Club home page Giter Club logo

3-balls-billiard-game's Introduction

3-Balls-Billiard-Game

Three-cushion billiards game to collision 3 billiard balls by cue stick on the billiard table. The game design according to proper object-oriented hierarchy by using Java.

Proper Object-Oriented (OO) hierarchy used. There are 3 standard balls defined including one white cue ball (ball1, ball2, ball3 by using Ellipse2D), Billiard Table (Table by using Rectangle2D) and 2 Cue Stick for each player (Stick by using Recangle2D).

The positions of the balls are updated after each stroke, with the if-else statements, balls blocked out from the table, so balls are always in the border of table, also to send the ball to the correct direction added “Math.hypot.(dx,dy)”.

The Velocity is related with instance of ball to mouse position. Velocity of the balls decrease after strokes from an initial velocity to zero (deceleration). Blocking the permission to hit the ball before it stops added “!isrunning” element in the mouseClicked function.

Mouse Listener used to control cue stick. When the user click to the table, power changes in direct proportion to the distance of the click location. If the striker ball hits the other two balls, score increases and if the score reaches to 50, game ends.

The program shows the speed and current location of the balls, and shows the score at the same time for each player. Program used Graphics (Java 2D API usage while designing the graphical elements).

Different cue sticks have different attributes. For instance, each player have different colour stick. Good game experience. The program has 2 player game in one computer mode. As a cheats codes if the user clicks the right button of mouse, the score increase 50 points.

3-balls-billiard-game's People

Watchers

Cagatay Sen avatar

3-balls-billiard-game's Issues

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.