This commit is contained in:
Charles 2001-07-18 16:09:39 +00:00
parent 58f7b9a09c
commit 2b53245342
3 changed files with 27 additions and 15 deletions

View file

@ -29,6 +29,7 @@ void CNpcMasherHazard::init()
CNpcHazard::init(); CNpcHazard::init();
m_state = MASHER_DROPPING; m_state = MASHER_DROPPING;
m_pauseTimer = 0;
} }
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@ -39,27 +40,34 @@ void CNpcMasherHazard::processMovement( int _frames )
{ {
case MASHER_DROPPING: case MASHER_DROPPING:
{ {
s8 yMovement = 3 * _frames; if ( m_pauseTimer <= 0 )
s8 groundHeight;
groundHeight = CGameScene::getCollision()->getHeightFromGround( Pos.vx, Pos.vy, yMovement + 16 );
if ( groundHeight < yMovement )
{ {
// colliding with ground s8 yMovement = 3 * _frames;
Pos.vy += groundHeight; s8 groundHeight;
// pause and change direction groundHeight = CGameScene::getCollision()->getHeightFromGround( Pos.vx, Pos.vy, yMovement + 16 );
m_state = MASHER_RISING; if ( groundHeight < yMovement )
{
// colliding with ground
Pos.vy += groundHeight;
// pause and change direction
m_state = MASHER_RISING;
}
else
{
// drop down
Pos.vy += yMovement;
}
} }
else else
{ {
// drop down m_pauseTimer -= _frames;
Pos.vy += yMovement;
} }
break; break;
@ -70,6 +78,8 @@ void CNpcMasherHazard::processMovement( int _frames )
if ( m_base.vx - Pos.vx == 0 && m_base.vy - Pos.vy == 0 ) if ( m_base.vx - Pos.vx == 0 && m_base.vy - Pos.vy == 0 )
{ {
m_state = MASHER_DROPPING; m_state = MASHER_DROPPING;
m_pauseTimer = GameState::getOneSecondInFrames();
} }
else else
{ {

View file

@ -33,6 +33,8 @@ protected:
}; };
MASHER_STATE m_state; MASHER_STATE m_state;
int m_pauseTimer;
}; };
#endif #endif

View file

@ -64,7 +64,7 @@ void CRestartPointTrigger::collidedWith(CThing *_thisThing)
collisionArea=getCollisionArea(); collisionArea=getCollisionArea();
respawnPos.vx=collisionArea.x1+((collisionArea.x2-collisionArea.x1)/2); respawnPos.vx=collisionArea.x1+((collisionArea.x2-collisionArea.x1)/2);
respawnPos.vy=collisionArea.y2; respawnPos.vy=collisionArea.y2;
((CPlayer*)_thisThing)->setRespawnPosAndRingTelephone(respawnPos); ((CPlayer*)_thisThing)->setRespawnPos(respawnPos);
break; break;
} }