diff options
author | Colin Noga <Tempus@chronometry.ca> | 2012-03-14 20:47:56 -0500 |
---|---|---|
committer | Colin Noga <Tempus@chronometry.ca> | 2012-03-14 20:47:56 -0500 |
commit | 18a6c3dbe01f484b346923ebc53f674c1e4a5101 (patch) | |
tree | da4b51a8a35de418128adb6c1c775dea4f6b6367 /src/shyguy.cpp | |
parent | c50be3fc02212aab84a9687f05b1ed5aa5695c78 (diff) | |
download | kamek-18a6c3dbe01f484b346923ebc53f674c1e4a5101.tar.gz kamek-18a6c3dbe01f484b346923ebc53f674c1e4a5101.zip |
commit junk
Diffstat (limited to 'src/shyguy.cpp')
-rw-r--r-- | src/shyguy.cpp | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/src/shyguy.cpp b/src/shyguy.cpp index ef807f0..34de1d9 100644 --- a/src/shyguy.cpp +++ b/src/shyguy.cpp @@ -65,6 +65,7 @@ class daShyGuy : public dEn_c { u32 cmgr_returnValue; bool isBouncing; float balloonSize; + char backFire; char spikeTurn; dStageActor_c *spikeA; dStageActor_c *spikeB; @@ -292,7 +293,19 @@ daShyGuy *daShyGuy::build() { dStateBase_c *stateVar; if (this->type < 6) { // Regular Shy Guys Except Jumper - stateVar = &StateID_FireKnockBack; + char FirePos; + + if (this->pos.x < apOther->owner->pos.x) { FirePos = 0; } // Fire is to the right + else { FirePos = 1; } // Fire is to the left + + + if (this->direction != FirePos) { // Fire is from behind + this->backFire = 1; + stateVar = &StateID_FireKnockBack; + } + else { + stateVar = &StateID_FireKnockBack; + } } else if (this->type > 8) { // Giants return; @@ -1328,7 +1341,10 @@ void daShyGuy::updateModelMatrices() { /////////////// void daShyGuy::beginState_FireKnockBack() { bindAnimChr_and_setUpdateRate("c18_C_BLOCK_BREAK_R", 1, 0.0, 1.0); - this->direction ^= 1; + + if (this->backFire == 0) { this->direction ^= 1; } + else { this->backFire = 0; } + this->speed.x = (this->direction) ? -this->XSpeed / 6.0f : this->XSpeed / 6.0f; } void daShyGuy::executeState_FireKnockBack() { |