// CSE 143 // Homework 5 // http://www.cs.washington.edu/education/courses/143/00su/homework/ // 30 Jul 2000, Ken Yasuhara // class MovingObject // // objects moving w/ constant velocity, i.e. not subject to any // acceleration (e.g. gravity); see also, Projectile #ifndef _MOVINGOBJECT_H_ #define _MOVINGOBJECT_H_ #include "object.h" class MovingObject : public Object { public: MovingObject(const double newX, const double newY, const double newVx, const double newVy) : Object(newX, newY), vx(newVx), vy(newVy), doneFlag(false) {} virtual void getNextPosition(double &nextX, double &nextY); virtual void updatePosition(); virtual void paint(GP142Display &display) const = 0; bool isDone() const { return doneFlag; } protected: // effectively disallow public use of default constructor MovingObject() {} // x and y components of velocity in pixels per frame update double vx, vy; bool doneFlag; }; #endif // _MOVINGOBJECT_H_