Commit 9058327f authored by Gerhard Stein's avatar Gerhard Stein

Arachnut is in. This foe is really dumb but dangerous

parent dad16e02
......@@ -32,6 +32,7 @@
#include "engine/galaxy/ai/ep4/CCouncilMember.h"
#include "engine/galaxy/ai/ep4/CMiragia.h"
#include "engine/galaxy/ai/ep4/CDiveSuit.h"
#include "engine/galaxy/ai/ep4/CArachnut.h"
#include "engine/galaxy/ai/ep4/CBounder.h"
#include "engine/galaxy/ai/ep4/CDopeFish.h"
#include "engine/galaxy/ai/ep4/CWaterMine.h"
......@@ -464,6 +465,11 @@ CGalaxySpriteObject* CMapLoaderGalaxy::addFoe(CMap &Map, word foe, size_t x, siz
p_newfoe = new galaxy::CMimrock(&Map, foe, x, y-(2<<CSF));
break;
case 20:
// This is an Arachnut.
p_newfoe = new galaxy::CArachnut(&Map, foe, x, y);
break;
case 21:
// This is a Mad Mushroom.
......@@ -521,6 +527,12 @@ CGalaxySpriteObject* CMapLoaderGalaxy::addFoe(CMap &Map, word foe, size_t x, siz
p_newfoe = new galaxy::CLick(&Map, foe, x, y);
break;
case 48: // I guess this happens in normal mode
// This is the Lick
if( g_pBehaviorEngine->mDifficulty > 1 )
p_newfoe = new galaxy::CLick(&Map, foe, x, y);
break;
case 50:
//This is the CBerkeloid
......
/*
* CArachnut.cpp
*
* Created on: 17.07.2012
* Author: gerstong
*/
#include "CArachnut.h"
#include "engine/galaxy/ai/CPlayerLevel.h"
#include "engine/galaxy/ai/CBullet.h"
#include "misc.h"
namespace galaxy
{
const int A_ARACHNUT_WALK = 0;
const int A_ARACHNUT_STUNNED = 4;
const int WALK_SPEED = 30;
CArachnut::CArachnut(CMap *pmap, const Uint16 foeID, Uint32 x, Uint32 y) :
CGalaxySpriteObject(pmap, foeID, x, y)
{
setupGalaxyObjectOnMap( 0x2378, A_ARACHNUT_WALK );
m_hDir = LEFT;
CSprite &rSprite = g_pGfxEngine->getSprite(sprite);
performCollisions();
processMove( 0, rSprite.m_bboxY1-rSprite.m_bboxY2 );
processActionRoutine();
}
bool CArachnut::isNearby(CSpriteObject &theObject)
{
if( !getProbability(80) )
return false;
if( CPlayerLevel *player = dynamic_cast<CPlayerLevel*>(&theObject) )
{
if( player->getXMidPos() < getXMidPos() )
m_hDir = LEFT;
else
m_hDir = RIGHT;
if( player->getYMidPos() < getYMidPos() )
m_vDir = UP;
else
m_vDir = DOWN;
}
return true;
}
void CArachnut::getTouchedBy(CSpriteObject &theObject)
{
if( theObject.dead )
return;
if( CBullet *bullet = dynamic_cast<CBullet*>(&theObject) )
{
bullet->setAction(A_KEENSHOT_IMPACT);
bullet->playSound( SOUND_SHOT_HIT );
setAction(A_ARACHNUT_STUNNED);
}
if( CPlayerBase *player = dynamic_cast<CPlayerBase*>(&theObject) )
{
player->kill();
}
}
void CArachnut::process()
{
performCollisions();
processFalling();
if( blockedl )
m_hDir = RIGHT;
else if( blockedr )
m_hDir = LEFT;
if( getActionStatus(A_ARACHNUT_WALK) )
setAction(A_ARACHNUT_WALK);
if( getActionNumber(A_ARACHNUT_WALK) )
{
// Move normally in the direction
if( m_hDir == RIGHT )
moveRight( WALK_SPEED );
else
moveLeft( WALK_SPEED );
}
processActionRoutine();
}
} /* namespace galaxy */
/*
* CArachnut.h
*
* Created on: 17.07.2012
* Author: gerstong
*/
#ifndef CARACHNUT_H_
#define CARACHNUT_H_
#include "engine/galaxy/CGalaxySpriteObject.h"
namespace galaxy {
class CArachnut : public CGalaxySpriteObject
{
public:
CArachnut(CMap *pmap, const Uint16 foeID, Uint32 x, Uint32 y);
bool isNearby(CSpriteObject &theObject);
void getTouchedBy(CSpriteObject &theObject);
void process();
};
} /* namespace galaxy */
#endif /* CARACHNUT_H_ */
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