Assignment 1

In this assignment, you are to create a simple game where the goal is to prevent a ball from hitting the ground by bouncing it off a bat (represented by a rectangle). Your program should look something like this:

Assignment 1 Sample.

Specific Behaviour

  • The windows should be 500 x 500 pixels
  • The ball should start at the top of the window
  • The bat should move with the horizontal movement of the mouse, specifically its centre shold be the mouse’s x coordinate
  • The y coordinate of the bat should be fixed near the bottom of the window
  • The ball should speed up each time it bounces off the top edge of the window
  • If the player misses the ball with the bat it should reappear at the top of the window, with its speed reset to the original speed
  • The game should function in a pleasant way without obvious flaws

The marking scheme below tells you exactly what we are looking for.

Marking

This assignment is marked out of 12. There are no bonus marks.

The marks for this assignment will be assigned as follows:

  • 1 mark for making the ball bounce off the left, right and top of the window.
  • 2 marks for making the ball bounce off the bat.
  • 1 mark for making the ball accelerate when it hits the top of the window.
  • 1 mark for making the ball reappear at the top of the window.
  • 2 marks for color:
    • using at least three different (distinguishable!) colors
    • setting the stroke of at least one shape to be a particular color
    • setting the fill of at least one shape to be a particular color
  • 1 mark for setting the background to be an original image that you create (e.g. using any simple paint program).
  • 2 marks for the quality of your game – this includes (but is not limited to) making sure that the ball does not move through the bat, and that it reaches the bat before bouncing.
  • 2 marks are for the quality of your source code. Specifically:
    • 1 mark for consistent and sensible indentation of your code.
    • 1 mark for sensible and self-descriptive variable names throughout your code. To get this mark, your program will need to use some variables in a sensible way.

Note that if your program does not run correctly, you will get 0 marks for this assignment.

What to Submit

Please name the program you write for this assignment asn1. What you should submit is the folder called asn1 that contains the program (which should be automatically called asn1.pde) and the image it needs. Compress this folder as an archive named asn1.zip (please only use .zip, and not some other archive format).

Submitting this Assignment

Please submit this assignment on-line no later than the due date listed on the course marking scheme. Late assignments may not be marked.

Table Of Contents