80 lines
1.5 KiB
C++
80 lines
1.5 KiB
C++
/*=========================================================================
|
|
|
|
nsstomp.cpp
|
|
|
|
Author: CRB
|
|
Created:
|
|
Project: Spongebob
|
|
Purpose:
|
|
|
|
Copyright (c) 2000 Climax Development Ltd
|
|
|
|
===========================================================================*/
|
|
|
|
#ifndef __ENEMY_NPC_H__
|
|
#include "enemy\npc.h"
|
|
#endif
|
|
|
|
#ifndef __GAME_GAME_H__
|
|
#include "game\game.h"
|
|
#endif
|
|
|
|
#ifndef __PLAYER_PLAYER_H__
|
|
#include "player\player.h"
|
|
#endif
|
|
|
|
|
|
void CNpcEnemy::processCloseSkullStomperAttack( int _frames )
|
|
{
|
|
s8 groundHeight;
|
|
s8 yMovement;
|
|
|
|
if ( m_timerTimer > 0 )
|
|
{
|
|
// wait
|
|
}
|
|
else
|
|
{
|
|
if ( m_extendDir == EXTEND_DOWN )
|
|
{
|
|
yMovement = m_data[m_type].speed * _frames;
|
|
|
|
groundHeight = m_layerCollision->getHeightFromGround( Pos.vx, Pos.vy, yMovement + 16 );
|
|
|
|
if ( groundHeight < yMovement )
|
|
{
|
|
// colliding with ground
|
|
|
|
Pos.vy += groundHeight;
|
|
|
|
// pause and change direction
|
|
|
|
m_timerTimer = GameState::getOneSecondInFrames();
|
|
m_extendDir = EXTEND_UP;
|
|
}
|
|
else
|
|
{
|
|
// drop down
|
|
|
|
Pos.vy += yMovement;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if ( m_base.vx - Pos.vx == 0 && m_base.vy - Pos.vy == 0 )
|
|
{
|
|
m_controlFunc = NPC_CONTROL_MOVEMENT;
|
|
m_timerFunc = NPC_TIMER_ATTACK_DONE;
|
|
m_timerTimer = GameState::getOneSecondInFrames();
|
|
m_sensorFunc = NPC_SENSOR_NONE;
|
|
m_npcPath.resetPath();
|
|
}
|
|
else
|
|
{
|
|
// return to original position
|
|
|
|
processGenericGotoTarget( _frames, m_base.vx - Pos.vx, m_base.vy - Pos.vy, 1 );
|
|
}
|
|
}
|
|
}
|
|
} |