2D Graphics Programming Project, 2009-10
The purpose of this project is to create a small object-oriented program that creates graphics using OpenGL and handles user-interactions from mouse and/or keyboard. Select one of the two options described below.
Project Specification – option 1
The basic look and functionality of the required program is described below:
Figure 1: A very rough sketch of the screen layout.
The screen layout in figure one shows roughly how the display should appear – the wall in the middle, the moving target on the right and the cannon on the left can be simple shapes or you can use bitmaps for a better appearance. The idea of the game is to fire projectiles from the cannon on the left that will aim to blow-up (or burst or vaporize or …)the target on the right.Assuming the physics is kept very simple, a projectile (cannonball) will keep a constant horizontal velocity (you can assume wind resistance on it is negligible) but will move vertically under the constraints of gravity. i.e. the initial vertical velocity (the upward speed it is fired from the cannon) will be reduced by a constant amount per second – eventually it will become an accelerating downward velocity (a typical trajectory is sown by the dashed line) and, hopefully, hit the target.
There are several basic components to the project:
- Creation of a static background (e.g. the wall and any other fixed components such as the base of the cannon)
- Creation of a cannon barrel that can be rotated around a fulcrum point (the small, white dot on the base of the cannon). The user needs to be able to set the angle of rotation by mouse or keyboard commands
- Creation of a moving target – this should bounce back and forward between the wall and the screen edge, the idea being to make it more of a challenge to hit it
- Creation of the projectiles – darts (to puncture an inflated target), bombs (to explode the target), weights (to crush the target), slime (to glug the target) or whatever scheme you wish to provide. These will have to simulate being fired as previously described, which can be managed by a fairly simple animation process:
Note that shaped projectiles (like darts) would take more work to animate because you would want them to point in the direction of travel, which changes throughout the flight – your choice.
-
The biggest problem is likely to be rotating the cannon barrel – I ’ll provide hints for this during the rest of the module, but a look at the extra lecture materials on transformations (probably around week 8) will help – lecture 9 slide & chapter 10 notes are on Blackboard now.