Friday 16 December 2011

Christmas and Exam Break

This is the Final Update for a while, with the Christmas break and upcoming January exams it is difficult to devote time to the project

Work will Re-commence when the new term starts in February

Chris

Thursday 15 December 2011

Setting up the pockets

So far, the physics engine depends on the user clicking and dragging the mouse to control the speed and direction, this means that it can still be used for testing while the program is being developed.  


The pockets are set up using the getWidth() and getHeight() functions and the size of the radius.  The corner pockets are 2 radii wide by 2 radii high and the centre pockets are 4 radii wide.


Below is the code for the top left pocket

if((balls[i].position.getX() <= 2*balls[i].getRadius()) 
   && (balls[i].position.getY() <= 2*balls[i].getRadius()))


However we don't want the cue ball entering the pocket and being counted as a 'hit' so I added:

if((i>0) && (balls[i].position.getX() <= 2*balls[i].getRadius()) 
&& (balls[i].position.getY() <= 2*balls[i].getRadius()))
where the ball i=0 is the cue ball.

When this 'if' statement is fulfilled, the ball velocities are set to zero, a 1 is entered in the appropriate pocket of the hit array (in this case the hit array would be [1, 0, 0, 0, 0, 0] to indicate a hit in the first pocket), and the value of 'true' is returned to a later part of the code.

Thursday 1 December 2011

Interim Report

For the next few weeks focus will be on the Presentation and the Interim Report which is due in a few weeks time (14th Dec)

Chris