-
Notifications
You must be signed in to change notification settings - Fork 0
/
Cannonball.h
34 lines (29 loc) · 854 Bytes
/
Cannonball.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
/**
* @file Cannonball.h - Shot from the Cannon
* @author Kevin Lundeen
* @see "Seattle University, CPSC 2430, Spring 2018"
*/
#pragma once
#include "adt/Critter.h"
/**
* @class Cannonball - A shot object (that acts like a critter)
*
* Model/view/controller object for a Menagerie-style critter.
*
* The Cannonball is a 1-pixel object shot northbound from a Cannon.
* It only moves NORTH and the rotate() and reverse() methods do nothing.
* The rendering is a single magenta pixel.
*/
class Cannonball : public Critter {
public:
Cannonball(int row, int col);
void move();
void reverse();
void rotate();
void render(PixelMatrix &pxm) const;
Critter::Direction getHeading() const;
int getColumn() const;
std::ostream& print(std::ostream&) const;
private:
int r, c; // base is at this (r,c) location
};