void GhostTree::die() { mystate = STATE_DYING; sprite->set_action("dying", 1); glow_sprite->set_action("dying", 1); std::vector<TreeWillOWisp*>::iterator iter; for(iter = willowisps.begin(); iter != willowisps.end(); ++iter) { TreeWillOWisp *willo = *iter; willo->vanish(); } }
HitResponse Lantern::collision(GameObject& other, const CollisionHit& hit) { if (is_open()) { WillOWisp* wow = dynamic_cast<WillOWisp*>(&other); if (wow) { // collided with WillOWisp while grabbed and unlit SoundManager::current()->play("sounds/willocatch.wav"); lightcolor = Color(0,1,0); updateColor(); wow->vanish(); } TreeWillOWisp* twow = dynamic_cast<TreeWillOWisp*>(&other); if (twow) { // collided with TreeWillOWisp while grabbed and unlit SoundManager::current()->play("sounds/willocatch.wav"); lightcolor = twow->get_color(); updateColor(); twow->vanish(); } } return Rock::collision(other, hit); }