Develop a program that allows one to control the movement of a ball across the screen.
The ball can move on straight lines only, that is, up, down, left, or right. Pressing the
arrow keys on the keyboard changes the ball's location.
1. Develop a data representation for the current position of the ball. The position is
best described with a pair of positive integers.
2. Develop a data representation for velocity of the ball. You may assume that the
ball always moves exactly 10 pixels at a time but remember that velocity also
includes the direction of the movement.
3. Develop a data representation for the ball.
4. The function ball-image is written for you. It consumes (the representation of)
a ball and produces a rectangle of 300 x 300 pixels with a red dot (diameter 10
pixels) placed at the ball's position.
5. Design the function ball-next, which consumes (the representation of) a ball
and create a ball that represents where it will be after one "tick."
6. Design a function ball-change, which consumes a ball
Comments
Leave a comment