CS1 3rd Quarter Exam
From WLCS
Objective:
- Design and implement a game where a player may move side to side on the screen in order to dodge falling objects
- This exam is open-book, open-note, open-computer, CLOSED-person
Directions:
Player (5 points):
- Draw a Box (50x50 pixels) at the bottom middle of the screen and save it in a variable named player
- Your player should be able to ONLY move left and right
- The player may NOT leave the screen (i.e. there are walls on the left and right edges of the screen)
Falling objects (5 points):
- Draw a Circle (25 pixel radius) at the top of the screen and save it in a variable named ball
- Create a dy variable that is a random number between 5 and 20
- Your ball should fall from the top to the bottom of the screen
- Inside your game loop, if the ball reaches past the bottom of the screen, then...
- Reset its y-coordinate to 0
- Randomize its x-coordinate
Successful dodge counter (5 points):
- Every time the player successfully dodges a falling object, increase a counter on the screen by one
- HINT: A player successfully dodges if the object hits the bottom and you move it back to the top
Collisions (5 points):
- If the player collides with a falling object (i.e. if the object hits the player), then there should be a game over message
- If the player successfully avoids 100 falling objects, then there should be a win message
Bonus (5 points):
- Create 8+ falling objects that all work