Brun Stöver
← IAT 806

Lab 02 — Moving Circle

A circle bouncing off the edges of the canvas. Interact by clicking.

Notes

It was difficult to write the colour changing part. The random() function gave a float, but I needed an integer. I've used floor() to circumvent this. The random direction on click actually uses the float by allowing more range for the circle's speed. Growing and shrinking the ball gave some problems with the border collision. By nesting another if statment within the border collision the program 'checks' whether the ball is moving towards the wall it is colliding with.