OO Programming and Data Structures | CS 241

Skeet Project Description

Overview

Use your knowledge of object-oriented programming to write a basic target shooting game.

This project will use the same arcade library as the previous project. Please refer to that project for instructions about configuring your environment.

Instructions

Your assignment is to create a game that simulates skeet shooting. On the left side of the screen, clay pigeons, or targets are randomly thrown across the screen. On the bottom left corner of the screen, the "marksman" (the term is used very loosely here) aims the rifle. The object of the game is to hit the intended targets, and not other "safe" ones.

The following shows the game in action:

Skeet Game

Game Rules and Specification

  1. When there is no pigeon on the screen, a new one is created with a 1/50 probability.

  2. To make it more of a challenge, there are three types of pigeons:

    1. Standard Target

      • Rendered as a circle with a 20px diameter.

      • Destroyed with one hit.

      • 1 point is awarded for hitting it.

      • Use the arcade.draw_circle_filled to assist you.

    2. Strong Target

      • Rendered as a circle with a number inside of it.

      • The strong target should move more slowly than the others as defined below.

      • It takes 3 hits to destroy this target.

      • 1 point is awarded for each of the first two hits.

      • 5 points are awarded for the third hit that destroys the target.

    3. Safe Target

      • Rendered as a square.

      • Use the arcade.draw_rectangle_filled function to assist you.

      • This target should not be hit.

      • It is destroyed with a single hit.

      • A penalty of 10 points is incurred if this target is hit.

  3. The target type, direction, velocity, and timing to release (delay) are random according to the following constraints:

  4. Rifle

  5. Bullets

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 and data members for targets and bullets, the collision detection and keeping of the game score will be taken care of for you.

The game class expects the following interface to be present for targets and bullets:

Bullet
center : Point
velocity : Velocity
radius : float
__init__()
+advance() : None
+draw() : None
+is_off_screen(screen_width, screen_height) : Boolean
+fire(angle:float) : None
Target
center : Point
velocity : Velocity
radius : float
alive : Boolean
+__init__()
+advance() : None
+draw() : None
+is_off_screen(screen_width, screen_height) : Boolean
+hit() : int

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

Getting Started

You will use the same framework and library that you used for Pong, plus the Skeet specific classes from the instructor's half. You can copy this file from: skeet.py.

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, the targets should all be put in the same list and then treated "identically" throughout the game code. In other words, it should not have a separate list for each type of target.

Code hints and suggestions

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:

For simplicity, for this assignment, you are welcome to put all of your classes in the same .py file.

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.