CS3500 Computer Graphics Spring 2009 Programming Assignment 1 Due: 10PM on Feb 01, 2009 The objective of this assignment is to make a 2D Computer Game with interesting graphics component. Specifically, different shapes and colours should be involved and different 2D transformations should be tested out. The assignment has to be done individually. Those with odd roll numbers should implement Asteroid Shooter and those with even roll numbers should implement Road Fighter. If someone has a pet 2D game of even greater complexity, contact the TAs and convince them it is of greater difficulty and you can get permission to implement that instead. In either case, you have to implement the logic of the game as well as the visual aspects of it using Graphics. The former can involve considerable geometric calculations, random number generation, data structure manipulation, etc. 1. Asteroid Shooter There is a triangular spacecraft at the bottom of the screen. From random positions on the top of the screen asteroids will appear and move with constant linear velocity, the magnitude and direction of which are also random within limits, such that they all hit the bottom if left alone. These asteroids are of random non-symmetric polygonal shape, size (with a min and max), and colour. The asteroids also spin continuously with a random angular velocity. The time between the appearances of two asteroids is also random. Not more than a maximum number of asteroids may be present at any one time. The player can control the spacecraft and has to prevent it from being hit by an asteroid. The craft can move only left and right and can shoot tiny rectangular bullets. On successfull shooting, a score equal to the area of the asteroid-polygon times the height at which it is hit is added to the player. If a bullet hits an asteroid, both, the bullet and the asteroid disappear. The asteroids disappear when they touch the bottom of the screen. The game gets over when spacecraft collides with an asteroid or when 30 seconds elapse, whichever is earlier. You should use the keyboard to control the spacecraft and to shoot. The sky window should have appropriate look and appearance such as stars etc. The time since the start of the game and the current score earned by the player should be displayed as appropriate. For extra credit, implement three levels of the game. As the level increases, the max velocity of the asteroids and the maximum number of asteroids present at any time increases. 2. Road Fighter A racing track on which the player's car (a polygonal approximation) races against other cars. The player has to take his car to the finish line which is 100 units of length away within the given time of 30 seconds. The maximum speed of the car is 5 units/second. The width of the track changes to a random value (within min and max) at regular intervals (called segments) on the track. The interval can be fixed at 5% of the total length of the track. The width changes linearly between segments. If the player's car hits the boundry of the track or another car, it rotates at that point for sometime (2-3 sec) and then comes back to the normal position. The player loses 10 points when this happens. The controls of the car are forward, left, right and brake. The other cars on the road appear from the top at random intervals, with a maximum of 3 cars at any time. Each car should have a different and random colour. The player's car always remains at the centre of the screen. It is the track that moves back faster when the player accelerates. Different segments of the track has different and random shades of gray between 0.4 and 0.8. The colour also indicates its friction coefficient. Thus, the car faces no deceleration on roads with colour 0.8 and decelerates at 0.5 unit/sec^2 on roads with colour 0.4. You should use the keyboard to control the car. The track and outside of it should have realistic colours and feel. The time since the start of the game and the current score earned by the player should be displayed as appropriate. For extra credit, implement three levels of the game. As the level increases, the maximum velocity of the player's car and the maximum number of other cars present at any time increase. Grading: (Maximum of 100 marks) -------- 60 points for getting the functionality right. 30 for the user interface and controls. 10 for the look and feel. Additional 10 points for the extra credit work. Subject to a maximum of 100 points per assignment. While grading, the projects will be executed to examine the functionality. The source code will be browsed through and each of you will have to demonstrate that you understand the underlying code very well. The TAs may also grade the assignments in your presence. You may discuss strategies of implementation with your friends, but copying assignments will be viewed very seriously and you risk getting an F grade for the course. Submission: ----------- You will have to submit a tgz or zip version of all necessary files on the day of the submission to a portal. Only an exact submitted version can be used while grading the assignment. Late submissions will be penalized. Time management is an essential skill you should learn.