Assignment 5

Balloon shooting

For your final assignment, you will make a program that draws a balloon on the screen and cross-hairs following the mouse. When the user clicks the balloon, it explodes.

The explosion will be modelled by a particle system.

Balloon exploding

Implementation

This assignment is marked of 30, with 5 bonus marks.

You will build this program in steps.

Balloon (10 marks)

Implement a class called Balloon that represents the balloon object. How to draw a balloon is up to you, but an image will probably be more fun.

The balloon starts at the bottom of the screen and slowly accelerates upwards. If it reaches the top, it should reappear at the bottom.

The class should implement the following functions:

  1. (2 marks) Constructor.

  2. (3 marks) void render()

    Draw the balloon, and nothing else!

  3. (3 marks) void update()

    Update the balloon’s position, and nothing else!

  4. (2 marks) boolean wasClicked().

    Should return true if the balloon was clicked, and nothing else!

Note that the code for these 3 functions depends on whether you choose to use an image or draw a shape.

Explosion (10 marks)

The explosion should be a particle system similar to the system described in the notes. That is, you will need to model each particle of the explosion in a class, as well as the explosion itself in another class. The properties of the particles should be somewhat random.

Refer to the explosion notes for details.

Cross-hairs (2 marks)

As you may have noticed, the images above display cross-hairs instead of the usual mouse cursor. To achieve this effect you will need two things:

  1. Define a Crosshairs class. This class has exactly one method - render() which draws the cross-hairs at the mouse position. The cross-hairs can be anything you like, an image, or a collection of shapes that you draw.
  2. You will need to tell Processing to not display the cursor. this would be a good place to start looking for a way to do this.

Main Program (3 marks)

As mentioned, the balloon starts at the bottom of the screen and climbs its way up. If the user clicks on the balloon, the balloon disappears and an explosion is displayed instead. If the balloon reaches the top without exploding, it should reappear at the bottom.

Clicking the mouse button after the balloon has exploded causes the balloon to reappear.

Style (5 marks)

As always, marks are assignment to the style and structure of your program. Specifically -

  1. draw() and setup() should be very simple. As seen in lecture, all of the heavy lifting is done by the objects you create.
  2. Clear and consistent indentation.
  3. Clear and consistent variable names

Bonus

  1. (3 marks) A wisp of smoke appears at the location of the mouse after the user clicks the balloon. This should be implemented using a particle system.
  2. (2 marks) An explosion sound is played when the explosion is visible.

What to Submit

Name your source code file firstname_lastname_studentNum_assn5.pde, where firstname_lastname is your full name separated by an underscore and studentNum is your student number.

What you should submit is a folder called firstname_lastname_studentNum_assn5 that contains the pde file, and any images you used inside a folder named data. If you used a sound file, be sure to include that as well.

Compress this folder as an archive named firstname_lastname_studentNum_assn5.zip.

The entire submission, when zipped, should be no more than 10 megabytes in size, or the system will not let you submit.

How to Submit

Please submit this assignment on-line no later than the due date listed on the course marking scheme.

If you submit the assignment after the deadline, you will be deducted %10 of the maximum points available for the assignment, for each day that you are late. For example if the assignment when submitted on time is marked out of 100, then after one day the maximum mark will be 90, after two days it will be 80, and so on.

Warning

Several minutes late is the same as a day late! While we have been lenient in the past, we will not be from now on. Give yourself at least a half hour to make sure you submit your assignment on time. Further, we will be using the clock on the submission system, not the one on your computer.

Warning

After submitting your assignment, download it, open the zip archive and make sure that you have submitted the correct files and that everything works. If something goes wrong, then by the time the TA gets to your assignment it will be too late to do anything about it and you will receive a 0 on your assignment.

Previous topic

Assignment 4