#include "badguy.hpp"
#include "object/camera.hpp"
+#include "object/tilemap.hpp"
+#include "tile.hpp"
#include "statistics.hpp"
static const float SQUISH_TIME = 2;
case STATE_INACTIVE:
return ABORT_MOVE;
case STATE_ACTIVE: {
- if(other.get_flags() & FLAG_SOLID)
- return collision_solid(other, hit);
+ TileMap* tilemap = dynamic_cast<TileMap*> (&other);
+ if(tilemap != 0) {
+ const TilemapCollisionHit* thit
+ = static_cast<const TilemapCollisionHit*> (&hit);
+ if(thit->tileflags & Tile::SPIKE)
+ kill_fall();
+ if(thit->tileflags & Tile::SOLID)
+ return collision_solid(other, hit);
+ return FORCE_MOVE;
+ }
BadGuy* badguy = dynamic_cast<BadGuy*> (&other);
if(badguy && badguy->state == STATE_ACTIVE)
void
BadGuy::kill_squished(Player& player)
{
- sound_manager->play("sounds/squish.ogg", get_pos());
+ sound_manager->play("sounds/squish.wav", get_pos());
physic.enable_gravity(true);
physic.set_velocity_x(0);
physic.set_velocity_y(0);
void
BadGuy::kill_fall()
{
- sound_manager->play("sounds/fall.ogg", get_pos());
+ sound_manager->play("sounds/fall.wav", get_pos());
global_stats.add_points(BADGUYS_KILLED_STAT, 1);
physic.set_velocity_y(0);
physic.enable_gravity(true);