: WalkingBadguy(reader, "images/creatures/mr_tree/mr_tree.sprite","left","right")
{
walk_speed = WALKSPEED;
- max_drop_height = 0;
+ max_drop_height = 16;
sound_manager->preload("sounds/mr_tree.ogg");
}
}
bool
-MrTree::collision_squished(Player& player)
+MrTree::collision_squished(GameObject& object)
{
// replace with Stumpy
Vector stumpy_pos = get_pos();
// give Feedback
sound_manager->play("sounds/mr_tree.ogg", get_pos());
- player.bounce(*this);
+ Player* player = dynamic_cast<Player*>(&object);
+ if (player) player->bounce(*this);
// spawn some particles
// TODO: provide convenience function in MovingSprite or MovingObject?
// spawn PoisonIvy
Vector leaf1_pos = Vector(stumpy_pos.x - POISONIVY_WIDTH - 1, stumpy_pos.y - POISONIVY_Y_OFFSET);
Rect leaf1_bbox = Rect(leaf1_pos.x, leaf1_pos.y, leaf1_pos.x + POISONIVY_WIDTH, leaf1_pos.y + POISONIVY_HEIGHT);
- if (Sector::current()->is_free_space(leaf1_bbox)) {
+ if (Sector::current()->is_free_of_movingstatics(leaf1_bbox, this)) {
PoisonIvy* leaf1 = new PoisonIvy(leaf1_bbox.p1, LEFT);
leaf1 = leaf1;
Sector::current()->add_object(leaf1);
// spawn PoisonIvy
Vector leaf2_pos = Vector(stumpy_pos.x + sprite->get_current_hitbox_width() + 1, stumpy_pos.y - POISONIVY_Y_OFFSET);
Rect leaf2_bbox = Rect(leaf2_pos.x, leaf2_pos.y, leaf2_pos.x + POISONIVY_WIDTH, leaf2_pos.y + POISONIVY_HEIGHT);
- if (Sector::current()->is_free_space(leaf2_bbox)) {
+ if (Sector::current()->is_free_of_movingstatics(leaf2_bbox, this)) {
PoisonIvy* leaf2 = new PoisonIvy(leaf2_bbox.p1, RIGHT);
leaf2 = leaf2;
Sector::current()->add_object(leaf2);