0% found this document useful (0 votes)
2 views2 pages

Simple Game Background Implementation

This document provides instructions for modifying a simple game code from last week to include a scrolling background. Students are told to download a background image file and create a Background class similar to the Asteroid class to manage displaying the scrolling background. The updateWorld method needs to be changed so that the background image appears to move down the screen like the asteroids. To avoid empty space, the background image should be drawn twice - at its y position and again 500 pixels higher to continuously fill the screen. Once these modifications are complete and the game includes asteroids, rocket movement and collision detection, students should submit their updated game code.
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views2 pages

Simple Game Background Implementation

This document provides instructions for modifying a simple game code from last week to include a scrolling background. Students are told to download a background image file and create a Background class similar to the Asteroid class to manage displaying the scrolling background. The updateWorld method needs to be changed so that the background image appears to move down the screen like the asteroids. To avoid empty space, the background image should be drawn twice - at its y position and again 500 pixels higher to continuously fill the screen. Once these modifications are complete and the game includes asteroids, rocket movement and collision detection, students should submit their updated game code.
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

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