You are on page 1of 2

U NIVERSITY OF THE W ITWATERSRAND , J OHANNESBURG

COMS2003: Application and Analysis of Algorithms II


A3 Laboratory 12 2012

A Simple Game : Final Submission


1. We will be working with the simple game that you worked on last week. 2. This week, we will make some modications to the code you had last week. 3. Most of these will be done by you without much guidance. Remember, google is your friend.

Scrolling Background
1. Without a background, the game looks kind of empty. In order to avoid this problem, we will make use of a scrolling background. 2. Download the sample background from the moodle site. Feel free to use some other background or to make your own. Be aware that this will be simpler if the background is the same size as your screen (500500) 3. Note that since you are moving forward, or upwards along the screen, the background will move downwards on the screen 4. This means that the background will move in a similar way to the asteroids, except that the background will be MUCH larger, and always at an x coordinate of 0. 5. Make a Background class that looks exactly like your asteroid class, except using the image supplied from moodle or your own background image. 6. Now, change your updateWorld method so that it seems that the background is falling down the screen in the same way that the asteroids do. 7. Note that this leaves a big space above the background as it falls! In order to avoid this problem, when you draw the image for the background, draw it TWICE. Once at the location it is supposed to be at (its y value), and again 500 pixels above it (y-500). This will draw the background again so that the whole space is lled.

8. When your game has a working scrolling background from this lab as well as asteroids that are made of images, smooth rocket motion and collision detection that quits when you get hit from the previous labs, submit your game to the moodle system.

You might also like