23 10_bouncingballs_easy - agarmstrong21/agarmstrong_swd_2019 GitHub Wiki

23-10_BouncingBalls_Easy

Portfolio Home Page

Problem Statement

image

User Documentation

BouncingBalls is a GUI that throws a ball across the window depending on the size. Once it hits an edge or wall, it will bounce back but in the opposite direction. This ball will stop and start whenever the mouse is clicked. This uses a thread to repaint the circle or ball every times it moves.

Developer Documentation

BouncingBallDriver creates the GUI Window and starts up the BouncingBall Class. This class starts the thread and executes it. This class will also create the Ball object too. Ball Class will have a continuous while loop to move and repaint the circle once it is created. The moving method moves the ball in a direction depending on the sign of the velocity. The velocity sign will flip if the ball hits a ball, thus causing the ball to move positions in the opposite direction. Then once the positions are updated, the ball class will repaint the circle in the new position.

image

Java Docs

The java documents are served from a local web server on this machine. To start the web server, navigate to the directory immediately above where the source code is checked out (i.e. ~/git ) and then use "python -m SimpleHTTPServer" in that directory.

cd ~/git python -m SimpleHTTPServer&

Note: if you are running python 3 (which you can check via opening a terminal and typing: python --version), then the command is:

python3 -m http.server

Java Docs for 23-10_BouncingBalls_Easy

Source Code

Source Code for 23-10_BouncingBalls_Easy