Commit 099e27e5 authored by Gerstrong's avatar Gerstrong

Better Platform code

parent 07bac5c0
......@@ -164,7 +164,7 @@ public:
void processMove(const VectorD2<int>& dir);
void processMoveBitLeft();
void processMoveBitRight();
void processMoveBitDown();
virtual void processMoveBitDown();
void processMoveBitUp();
void processMove(const int xoff, const int yoff);
......
......@@ -9,6 +9,7 @@
#include "CBullets.h"
#include "CItemEffect.h"
#include "common/CBehaviorEngine.h"
#include "platform/CPlatform.h"
#include "sdl/CInput.h"
#include "sdl/sound/CSound.h"
#include "CVec.h"
......@@ -65,6 +66,23 @@ mp_processState(&CPlayerLevel::processStanding)
m_camera.setPosition(m_Pos);
}
// This special code is important, so platforms in all cases will catch Keen when he is falling on them
void CPlayerLevel::processMoveBitDown()
{
for( int i = 0 ; i<m_ObjectPtrs.size() ; i++ )
{
if( CPlatform *platform = dynamic_cast<CPlatform*>(m_ObjectPtrs[i]) )
{
platform->getTouchedBy(*this);
}
}
CObject::processMoveBitDown();
}
void CPlayerLevel::getAnotherLife(const int &lc_x, const int &lc_y)
{
m_Inventory.Item.m_lifes++;
......
......@@ -231,6 +231,10 @@ public:
bool m_jumpdownfromobject;
private:
/** \brief Special code when Keen moving down... */
void processMoveBitDown();
std::vector<CObject*>& m_ObjectPtrs;
char m_playcontrol[PA_MAX_ACTIONS];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment