2 #include "globalfunc.h"
9 Robot::Robot( Uint8 X
, Uint8 Y
) : LivingMapObject( X
, Y
)
12 vX
= sign( Game::getPlayer()->getMapX() - mapX
);
13 vY
= sign( Game::getPlayer()->getMapY() - mapY
);
17 float Robot::SPEED() { return ROBOT_SPEED
; }
19 bool Robot::isWalkable( Uint8 X
, Uint8 Y
)
21 Tile
*t
= Game::getMap()->tileAt(X
, Y
);
23 (isBitSet( t
->typeMask
, Tile::TILE_WALKABLE
) ||
24 isBitSet( t
->typeMask
, Tile::TILE_EFENCE
)) &&
25 !Game::getMap()->isRobotOn(mapX
+vX
, mapY
+vY
)
34 void Robot::OnTile( Tile
*t
)
36 if( isBitSet( t
->typeMask
, Tile::TILE_EFENCE
) )
38 Game::getMap()->RemoveTile( mapX
, mapY
);
42 if( mapX
== Game::getPlayer()->getMapX() &&
43 mapY
== Game::getPlayer()->getMapY() )
45 Game::getPlayer()->Die();
49 vX
= sign( Game::getPlayer()->getMapX() - mapX
);
50 vY
= sign( Game::getPlayer()->getMapY() - mapY
);