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/toughBird.cpp | |
parent | 495f771530ce1869098bc568f34c243697cab73c (diff) | |
download | skeet-cs165-70ea8877ace50d2ce609d7d5f721c887b0ea83ec.tar.gz skeet-cs165-70ea8877ace50d2ce609d7d5f721c887b0ea83ec.zip |
Added files
Diffstat (limited to 'src/toughBird.cpp')
-rw-r--r-- | src/toughBird.cpp | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/src/toughBird.cpp b/src/toughBird.cpp new file mode 100644 index 0000000..51d5cec --- /dev/null +++ b/src/toughBird.cpp @@ -0,0 +1,41 @@ +#include "toughBird.h" +#include "bullet.h" +#include "uiDraw.h" +#include <math.h> + +// ToughBird default constructor +ToughBird :: ToughBird() : Bird() +{ + health = 3; + setRandomDy( 4.5 , 6.5 ); +} + +// Hit ToughBird +int ToughBird :: hit() +{ + if ( health > 1 ) + { + health -= 1; + return 1; + } + else + { + kill(); + return 2; + } + return 0; +} + + +// Apply gravity to ToughBird +void ToughBird :: applyGravity () +{ + this->velocity.addDy ( -0.05 ); +} + + +// Draw ToughBird +void ToughBird :: draw() +{ + drawToughBird( point , 15 , health ); +} |