예제 #1
0
bool
MrBomb::collision_squished(GameObject& object)
{
  auto player = dynamic_cast<Player*>(&object);
  if (player && player->is_invincible()) {
    player->bounce(*this);
    kill_fall();
    return true;
  }
  if (is_valid()) {
    auto& bomb = Sector::get().add<Bomb>(get_pos(), m_dir, m_sprite_name);

    // Do not trigger dispenser because we need to wait for
    // the bomb instance to explode.
    if (get_parent_dispenser() != nullptr)
    {
      bomb.set_parent_dispenser(get_parent_dispenser());
      set_parent_dispenser(nullptr);
    }

    remove_me();
  }
  kill_squished(object);
  return true;
}
예제 #2
0
bool
Crystallo::collision_squished(GameObject& object)
{
  this->set_action(dir == LEFT ? "shattered-left" : "shattered-right", /* loops = */ -1, ANCHOR_BOTTOM);
  kill_squished(object);
  return true;
}
예제 #3
0
bool
SpiderMite::collision_squished(Player& player)
{
  sprite->set_action(dir == LEFT ? "squished-left" : "squished-right");
  kill_squished(player);
  return true;
}
예제 #4
0
bool
Zeekling::collision_squished(GameObject& object)
{
  m_sprite->set_action(m_dir == Direction::LEFT ? "squished-left" : "squished-right");
  kill_squished(object);
  return true;
}
예제 #5
0
파일: yeti.cpp 프로젝트: christ2go/supertux
bool
Yeti::collision_squished(GameObject& object)
{
  kill_squished(object);

  return true;
}
예제 #6
0
bool
Toad::collision_squished(GameObject& object)
{
  sprite->set_action(dir == LEFT ? "squished-left" : "squished-right");
  kill_squished(object);
  return true;
}
bool
BouncingSnowball::collision_squished(GameObject& object)
{
  sprite->set_action("squished");
  kill_squished(object);
  return true;
}
예제 #8
0
파일: mrbomb.cpp 프로젝트: leper/supertux
bool
MrBomb::collision_squished(GameObject& object)
{
  auto player = dynamic_cast<Player*>(&object);
  if(player && player->is_invincible()) {
    player->bounce(*this);
    kill_fall();
    return true;
  }
  if(is_valid()) {
    auto bomb = std::make_shared<Bomb>(get_pos(), dir, sprite_name);

    // Do not trigger dispenser because we need to wait for
    // the bomb instance to explode.
    if(this->get_parent_dispenser() != NULL)
    {
      bomb->set_parent_dispenser(this->get_parent_dispenser());
      this->set_parent_dispenser(NULL);
    }
    remove_me();
    Sector::current()->add_object(bomb);
  }
  kill_squished(object);
  return true;
}
예제 #9
0
bool
MrBomb::collision_squished(Player& player)
{
  remove_me();
  Sector::current()->add_object(new Bomb(get_pos(), dir));
  kill_squished(player);
  return true;
}
예제 #10
0
bool
Zeekling::collision_squished(Player& player)
{
    sprite->set_action(dir == LEFT ? "squished-left" : "squished-right");
    kill_squished(player);
    kill_fall();
    return true;
}
예제 #11
0
bool
LeafShot::collision_squished(GameObject& object)
{
  sprite->set_action(dir == LEFT ? "squished-left" : "squished-right");
  // Spawn death particles
  spawn_explosion_sprites(3, "images/objects/particles/leafshot.sprite");
  kill_squished(object);
  return true;
}
예제 #12
0
bool
SkullyHop::collision_squished(GameObject& object)
{
  if (frozen)
    return BadGuy::collision_squished(object);

  sprite->set_action(dir == LEFT ? "squished-left" : "squished-right");
  kill_squished(object);
  return true;
}
예제 #13
0
bool
Dispenser::collision_squished(GameObject& object)
{
  //TODO: Should it act like a normal tile when killed?
  sprite->set_action(dir == LEFT ? "broken-left" : "broken-right");
  dispense_timer.start(0);
  Player* player = dynamic_cast<Player*>(&object);
  if (player) player->bounce(*this);
  kill_squished(object);
  return true;
}
예제 #14
0
bool
Totem::collision_squished(Player& player)
{
  if (carrying) carrying->jump_off();
  if (carried_by) {
    player.bounce(*this);
    jump_off();
  }

  sprite->set_action(dir == LEFT ? "squished-left" : "squished-right");
  this->bbox.set_size(48, 45);
  kill_squished(player);
  return true;
}
예제 #15
0
bool
Totem::collision_squished(Player& player)
{
  if (carrying) carrying->jump_off();
  if (carried_by) {
    player.bounce(*this);
    jump_off();
  }

  sprite->set_action(dir == LEFT ? "squished-left" : "squished-right");
  bbox.set_size(sprite->get_current_hitbox_width(), sprite->get_current_hitbox_height());

  kill_squished(player);
  return true;
}
예제 #16
0
bool
Totem::collision_squished(GameObject& object)
{
  if (carrying) carrying->jump_off();
  if (carried_by) {
    Player* player = dynamic_cast<Player*>(&object);
    if (player) player->bounce(*this);
    jump_off();
  }

  sprite->set_action(dir == LEFT ? "squished-left" : "squished-right");
  bbox.set_size(sprite->get_current_hitbox_width(), sprite->get_current_hitbox_height());

  kill_squished(object);
  return true;
}
예제 #17
0
bool
MrBomb::collision_squished(GameObject& object)
{
  auto player = dynamic_cast<Player*>(&object);
  if(player && player->is_invincible()) {
    player->bounce(*this);
    kill_fall();
    return true;
  }
  if(is_valid()) {
    remove_me();
    Sector::current()->add_object(std::make_shared<Bomb>(get_pos(), dir, sprite_name));
  }
  kill_squished(object);
  return true;
}
예제 #18
0
bool
Stumpy::collision_squished(GameObject& object)
{

  // if we're still invincible, we ignore the hit
  if (mystate == STATE_INVINCIBLE) {
    SoundManager::current()->play("sounds/mr_treehit.ogg", get_pos());
    Player* player = dynamic_cast<Player*>(&object);
    if (player) player->bounce(*this);
    return true;
  }

  // if we can die, we do
  if (mystate == STATE_NORMAL) {
    sprite->set_action(dir == LEFT ? "squished-left" : "squished-right");
    set_size(sprite->get_current_hitbox_width(), sprite->get_current_hitbox_height());
    kill_squished(object);
    // spawn some particles
    // TODO: provide convenience function in MovingSprite or MovingObject?
    for (int i = 0; i < 25; i++) {
      Vector ppos = bbox.get_middle();
      float angle = graphicsRandom.randf(-M_PI_2, M_PI_2);
      float velocity = graphicsRandom.randf(45, 90);
      float vx = sin(angle)*velocity;
      float vy = -cos(angle)*velocity;
      Vector pspeed = Vector(vx, vy);
      Vector paccel = Vector(0, Sector::current()->get_gravity()*10);
      Sector::current()->add_object(std::make_shared<SpriteParticle>("images/objects/particles/bark.sprite",
                                                                     "default",
                                                                     ppos, ANCHOR_MIDDLE,
                                                                     pspeed, paccel,
                                                                     LAYER_OBJECTS-1));
    }

    return true;

  }

  //TODO: exception?
  return true;
}
예제 #19
0
파일: totem.cpp 프로젝트: leyyin/supertux
bool
Totem::collision_squished(GameObject& object)
{
  /// Tux shouldn't be able to bisect totem stack by sacrificing his powerup.
  /// --Hume2
  if (carrying) {
    return false;
  }

  if (carried_by) {
    Player* player = dynamic_cast<Player*>(&object);
    if (player) player->bounce(*this);
    jump_off();
  }

  sprite->set_action(dir == LEFT ? "squished-left" : "squished-right");
  bbox.set_size(sprite->get_current_hitbox_width(), sprite->get_current_hitbox_height());

  kill_squished(object);
  return true;
}