Reference no: EM132365383
Computer Programming Java Assignment - Lane Crossing
In this assignment we will begin creating an animation called "Lane Crossing".
Concepts assessed
1. Setting up a sketch in Processing.
2. Creating an animation.
3. Handling mouse and key events.
4. Using variables to change state of objects.
5. Problem-solving (the balls cross in the same time).
6. Some use of conditions.
In this assignment you must draw, and animate, two semi-transparent circles, travelling in lanes, that cross each other in the centre of the display window.
Note - You must ensure that the balls stop such that the rightmost point of the green ball just touches the right wall and the bottommost point of the red ball just touches the floor of the display window. You must reset the balls when the mouse is pressed and update speeds using UP and DOWN arrow keys. Pressing the UP key results in doubling of speed and pressing the DOWN key results in halving of speed.
Coding style - Make sure,
Your variable names reflect their purpose. Variable names like a, b, c, d, e, f are not recommended.
Code is well-indented.
- Add one level of indentation whenever you enter a function or a conditional block.
- Reduce one level of indentation whenever you exit a function or a conditional block.
Code is appropriately commented. Do not comment each line and don't add comments re-iterating the code. For example, a comment like "increase x by 1" against a statement "x=x+1;" is not recommended.