diff options
author | Logan Hunt <loganthebean222@gmail.com> | 2020-08-12 14:13:50 -0600 |
---|---|---|
committer | Logan Hunt <loganthebean222@gmail.com> | 2020-08-12 14:13:50 -0600 |
commit | 70ea8877ace50d2ce609d7d5f721c887b0ea83ec (patch) | |
tree | 514aa4f3d10b0a1db21928f8a002aa10458ecbb5 /src/rifle.cpp | |
parent | 495f771530ce1869098bc568f34c243697cab73c (diff) | |
download | skeet-cs165-70ea8877ace50d2ce609d7d5f721c887b0ea83ec.tar.gz skeet-cs165-70ea8877ace50d2ce609d7d5f721c887b0ea83ec.zip |
Added files
Diffstat (limited to 'src/rifle.cpp')
-rw-r--r-- | src/rifle.cpp | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/src/rifle.cpp b/src/rifle.cpp new file mode 100644 index 0000000..355d42f --- /dev/null +++ b/src/rifle.cpp @@ -0,0 +1,45 @@ +/************************************************************* + * File: rifle.cpp + * Author: Br. Burton + * + * Description: Contains the function bodies for the rifle class. + * + * Please DO NOT share this code with other students from + * other sections or other semesters. They may not receive + * the same code that you are receiving. + *************************************************************/ + +#include "rifle.h" +#include "point.h" +#include "uiDraw.h" + +#include <cassert> + +void Rifle :: draw() const +{ + assert(angle >= ANGLE_MIN); + assert(angle <= ANGLE_MAX); + + drawRect(point, RIFLE_WIDTH, RIFLE_HEIGHT, 90 - angle); +} + +void Rifle :: moveLeft() +{ + angle -= RIFLE_MOVE_AMOUNT; + + if (angle < ANGLE_MIN) + { + angle = ANGLE_MIN; + } +} + + +void Rifle :: moveRight() +{ + angle += RIFLE_MOVE_AMOUNT; + + if (angle > ANGLE_MAX) + { + angle = ANGLE_MAX; + } +} |