physic.set_velocity_y(0);
// start a timer to delay addition of upward movement until we are (hopefully) out from under the player
- kicked_delay_timer.start(0.05);
+ kicked_delay_timer.start(0.05f);
}
bool
}
bool
-Snail::collision_squished(Player& player)
+Snail::collision_squished(GameObject& object)
{
switch(state) {
case STATE_FLAT:
sound_manager->play("sounds/kick.wav", get_pos());
-
- if(player.get_pos().x < get_pos().x) {
- dir = RIGHT;
- } else {
- dir = LEFT;
+ {
+ MovingObject* movingobject = dynamic_cast<MovingObject*>(&object);
+ if (movingobject && (movingobject->get_pos().x < get_pos().x)) {
+ dir = RIGHT;
+ } else {
+ dir = LEFT;
+ }
}
be_kicked();
break;
}
- player.bounce(*this);
+ Player* player = dynamic_cast<Player*>(&object);
+ if (player) player->bounce(*this);
return true;
}