CS 165 Project - Skeet

Overview

Skeet or Trap Shooting is a game played by hunters where a clay pigeon is ejected from a throwing device and a marksman attempts to shoot them with a shotgun. Sadly, many clay pigeons (also called "targets" or "birds") are lost during the typical game. Though this sport is an Olympic event and played the world over, it is far too dangerous to play in the computer lab. Therefore, we will build a safer version where nothing but pixels are shot.

This program will be written using the same simplified OpenGL libraries as the other projects of this semester. See this link for information about how to configure your environment for OpenGL development..

Instructions

Your assignment is to create a game that simulates skeet shooting. On the left side of the screen, clay pigeons are randomly shot across the screen. On the bottom right corner of the screen, the "marksman" (the term is used very loosely here) aims his rifle. Each match ends when either a bullet from the rifle destroys the pigeon or when the pigeon exits the screen (called "birds away").

A working version of the game is available to you at:

/home/cs165new/skeet.out

The following shows the game in action:

Skeet Game

Game Rules and Specification

  1. Whenever there is no pigeon on the screen, a new one is created at random.
  2. To make it more of a challenge, there are three types of pigeons:
    1. Standard Bird
      • Rendered as a circle with a 15px radius.
      • A drawCircle function is included in the uiDraw library to assist you.
      • Destroyed with one hit.
      • 1 Point is awarded for hitting it.
    2. Tough Bird
      • Rendered as a circle with a number inside of it.
      • A drawToughBird function is included in the uiDraw library to assist you.
      • The Tough Bird should move more slowly than the others as defined below.
      • It takes 3 hits to destroy this bird.
      • 1 Point is awarded for each hit.
      • A bonus of 2 points is awarded if it is destroyed. (3 points per hit, plus the 2 point bonus, means 5 points can be earned.)
    3. Sacred Bird
      • Rendered as a star.
      • A drawSacredBird function is included in the uiDraw library to assist you.
      • This bird should not be hit.
      • It is destroyed with a single hit.
      • A penalty of 10 points is lost if this bird is hit.
  3. The pigeon type, direction, velocity, and timing to release (delay) are random according to the following constraints:
    • The initial position of the bird is anywhere along the left side the screen
    • If the bird starts on the top half of the screen, it should have a generally downward velocity (down and to the right at amounts defined below).
    • If the bird starts on the bottom half of the screen, it should have a generally upward velocity (up and to the right at amounts defined below).
    • The horizontal component of the velocity should be between 3 and 6 pixels/frame.
    • The vertical component of the velocity should be between -4 and +4 pixels/frame (positive or negative depending on whether it starts on the top or bottom half of the screen).
    • To give the user a greater chance to hit the Tough Bird, it should move more slowly than the others. In particular, its horizontal velocity should be taken from the range: 2 to 4, and it's vertical velocity from the range -3 to +3.
    • A delay of up to 1 second should be introduced before the first bird is released or after each round before the next one is released.
  4. Rifle
    • Rendered as a rectangle.
    • A drawRect function is included in the uiDraw library to assist you.
    • The aim is controlled with the left and right arrows.
    • Each arrow press should change the aim 3 degrees.
    • The rifle should not be able to aim off the screen. (You must limit its movement to 90 degrees.)
  5. Bullets
    • Rendered as a dot.
    • A drawDot function is included in the uiDraw library to assist you.
    • There is no limit to the number of bullets.
    • Pressing the space bar fires a new bullet.
    • New bullets should be aimed in the direction of the rifle.
    • Bullets travel at 10 pixels/frame at that angle at which they are fired.
    • Bullets should be removed if they leave the borders of the screen.

Hints and examples

The following examples may be helpful:

Working with the Instructor

As with the last project, in order to help you stay focused on the most pertinent parts of the assignment, and to also help understand the value of agreeing upon an interface for your classes, you will again be working on a team comprised of you and the instructor.

As before, please recognize that other students in different sections, or different semesters may not be working in this way, so please DO NOT share the code you are receiving.

For this project the instructor will provide the Rifle class and most of the logic in the Game class. For the game class, you will be provided with the logic of moving the rifle, creating, advancing, and cleaning up bullets, and also checking for collisions.

You are responsible to implement the following:

Provided you correctly implement the methods for birds and bullets, the collision detection and actual game scoring will be taken care of for you.

The game class expects the following public methods to be present for birds and bullets:

Bullet
...
(private data is up to you)
...
...
+Bullet()
+getPoint() : Point
+getVelocity() : Velocity
+isAlive() : bool
+setPoint(Point) : void
+setVelocity(Velocity) : void
+kill() : void
+advance() : void
+draw() : void
+fire(point:Point, angle:float) : void
Bird
...
(private data is up to you)
...
...
+Bird(Point)
+getPoint() : Point
+getVelocity() : Velocity
+isAlive() : bool
+setPoint(Point) : void
+setVelocity(Velocity) : void
+kill() : void
+advance() : void
+draw() : void
+hit() : int

The hit() method for the Bird represents the bird being hit and should either kill the bird (or decrement the number of hits remaining for the tough bird) and return an integer representing the points scored for that hit.

Getting Started

You will use the same framework and classes that you used for MoonLander, plus the Skeet specific files from the Instructor's half. You can copy these files from: /home/cs165new/skeet/*.

Architectural Design

For this project you will be expected to use the principles of inheritance and polymorphism. These are the topics we will be studying over the next two weeks.

In order to demonstrate correct use of these design principles, in your game class, you need to have a pointer to your base class (e.g., Bird*) that you use to point to each different bird that is created. You should create each new bird via "new" and then make sure to "delete" it when it is dead. In other words, you should NOT have three different bird objects in your game class.

Assignments

You have two weeks to complete this project, with a milestone submission due at the end of the first week. Please note that this is a challenging project that will require you to apply several new and challenging topics.

This project will be broken up into the following assignment submissions:

Expectation to Excel

As explained in more detail in the Project link above, the requirements presented here are simply a base standard. To receive up to 100% on this assignment you are expected to show creativity and excel above and beyond what is specifically required.