top of page

User Input

A game isn't much use without user input; so I've implemented a first version of the control scheme, which includes a cue ball and cue object. The user can manipulate the cue on-screen using the cursor, which follows the cue ball, then drag and release to apply various (continuous) levels of force to the cue ball. This was done using mouse up/down, and mouse move listeners. My implementation could be refined further, but this is not a priority.

I have also fixed two bugs, one where pocket collision was not always detected, and another where balls would sometimes pass over rails if moving too fast. This was done by adjusting the system to use the correct mid-point co-ordinates, and extending the rail class to include a 'type' stating its position on the canvas and using a pair of switch statements to discretely determine the object we are colliding with, then passing this to the collision response logic.

bottom of page