diff options
author | unknown <paulx161@umn.edu> | 2021-02-02 18:35:09 -0600 |
---|---|---|
committer | unknown <paulx161@umn.edu> | 2021-02-02 18:35:09 -0600 |
commit | 7ea1b2c0320d74152d33e74718a39319a7a0e507 (patch) | |
tree | 7c2995f547889f00e381449b5c91dbb0abd1a0c3 /dev/a2-carsoccer/car.h | |
parent | Added /dev/gfxtest/* (diff) | |
download | csci4611-7ea1b2c0320d74152d33e74718a39319a7a0e507.tar csci4611-7ea1b2c0320d74152d33e74718a39319a7a0e507.tar.gz csci4611-7ea1b2c0320d74152d33e74718a39319a7a0e507.tar.bz2 csci4611-7ea1b2c0320d74152d33e74718a39319a7a0e507.tar.lz csci4611-7ea1b2c0320d74152d33e74718a39319a7a0e507.tar.xz csci4611-7ea1b2c0320d74152d33e74718a39319a7a0e507.tar.zst csci4611-7ea1b2c0320d74152d33e74718a39319a7a0e507.zip |
Added worksheet and support code for assignment 2
Diffstat (limited to 'dev/a2-carsoccer/car.h')
-rw-r--r-- | dev/a2-carsoccer/car.h | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/dev/a2-carsoccer/car.h b/dev/a2-carsoccer/car.h new file mode 100644 index 0000000..871f3bc --- /dev/null +++ b/dev/a2-carsoccer/car.h @@ -0,0 +1,44 @@ +/** CSci-4611 Assignment 2: Car Soccer + */ + +#ifndef CAR_H_ +#define CAR_H_ + +#include <mingfx.h> + +/// Small data structure for a car +class Car { +public: + + /// The constructor sets the static properties of the car, like its size, + /// and then calls Reset() to reset the position, velocity, and any other + /// dynamic variables that change during game play. + Car() : size_(3,2,4), collision_radius_(2.5) { + Reset(); + } + + /// Nothing special needed in the constructor + virtual ~Car() {} + + /// Resets all the dynamic variables, so if you call this after a goal, the + /// car will go back to its starting position. + void Reset() { + position_ = Point3(0, size_[1]/2, 45); + } + + float collision_radius() { return collision_radius_; } + + Vector3 size() { return size_; } + + Point3 position() { return position_; } + void set_position(const Point3 &p) { position_ = p; } + +private: + // You will probably need to store some additional data here, e.g., speed. + + Vector3 size_; + float collision_radius_; + Point3 position_; +}; + +#endif |