CS 105 (C++)

Assignment 8: Sprites





I. Overview


In this assignment, I will provide functions for rendering four different video game sprites, and you will develop polymorphic classes (one for each sprite) in such a way that all four of them can be drawn by making the same call through pointers having a single base class.

You will need to download the files drawing.h (here) and drawing.cpp (here).  You will gain access to the necessary drawing functions by including "drawing.h" in the main.cpp file that you create.  The following functions are declared in drawing.h:

void beginDrawing();
void drawShadow(int row, int col);
void drawSpeedy(int row, int col);
void drawBashful(int row, int col);
void drawPokey(int row, int col);
void drawErrorMessage(int row, int col);
void endDrawing();


Here's what you need to implement:
(Note: All of your code should exist entirely within the file main.cpp.)
If this is done correctly, the first four sprites from the image above will be rendered (although probably with slightly different colors) in a 2-by-2 arrangement.  Successful polymorphism will be indicated by the rendering of four different sprites, despite the fact that the same function call is made to all four base-class pointers.

To compile, include all necessary .cpp files along with the ncurses library flag as follows:

g++ main.cpp drawing.cpp -lncurses -o a8


II. Grading


The following is a list of specific assignment requirements, along with the grade value for each (out of a total of 10 points for the assignment).



Creative Commons License
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License.