{
sector->add_object(new PowerUp(get_pos() + Vector(0, 32), "images/powerups/iceflower/iceflower.sprite"));
sound_manager->play("sounds/upgrade.wav");
+ countdown = true;
+ break;
+ }
+
+ case CONTENT_STAR:
+ {
+ sector->add_object(new Star(get_pos() + Vector(0, 32), direction));
+ sound_manager->play("sounds/upgrade.wav");
+ countdown = true;
+ break;
+ }
+
+ case CONTENT_1UP:
+ {
+ sector->add_object(new OneUp(get_pos(), DOWN));
+ sound_manager->play("sounds/upgrade.wav");
+ countdown = true;
+ break;
+ }
+
+ case CONTENT_CUSTOM:
+ {
+ //NOTE: non-portable trampolines could be moved to CONTENT_CUSTOM, but they should not drop
+ object->set_pos(get_pos() + Vector(0, 32));
+ sector->add_object(object);
+ object = 0;
+ sound_manager->play("sounds/upgrade.wav");
+ countdown = true;
+ break;
+ }
+
+ case CONTENT_SCRIPT:
+ { break; } // because scripts always run, this prevents default contents from being assumed
+
+ case CONTENT_LIGHT:
+ {
+ try_open(player);
+ break;
+ }
+ case CONTENT_TRAMPOLINE:
+ {
+ try_open(player);
+ break;
+ }
+ case CONTENT_RAIN:
+ {
+ try_open(player);
break;
}
+
+ case CONTENT_STAR:
+ {
+ sector->add_object(new Star(get_pos() + Vector(0, 32), direction));
+ sound_manager->play("sounds/upgrade.wav");
+ break;
+ }
+
+ case CONTENT_1UP:
+ {
+ sector->add_object(new OneUp(get_pos(), DOWN));
+ sound_manager->play("sounds/upgrade.wav");
+ break;
+ }
+
+ case CONTENT_CUSTOM:
+ {
+ //TODO: non-portable trampolines could be moved to CONTENT_CUSTOM, but they should not drop
+ object->set_pos(get_pos() + Vector(0, 32));
+ sector->add_object(object);
+ object = 0;
+ sound_manager->play("sounds/upgrade.wav");
+ break;
+ }
+
+ case CONTENT_SCRIPT:
+ { break; } // because scripts always run, this prevents default contents from being assumed
+
+ case CONTENT_LIGHT:
+ {
+ try_open(player);
+ break;
+ }
+ case CONTENT_TRAMPOLINE:
+ {
+ try_open(player);
+ break;
+ }
+ case CONTENT_RAIN:
+ {
+ try_open(player);
+ break;
+ }
case CONTENT_EXPLODE:
{
hit_counter = 1; // multiple hits of coin explode is not allowed
Sector::current()->run_script(stream, "powerup-script");
}
++<<<<<<< HEAD
+ if(countdown){ // only decrease hit counter if try_open was not called
+ if(hit_counter == 1){
+ sprite->set_action("empty");
+ }else{
+ hit_counter--;
+ }
++=======
+ if(hit_counter <= 0 || contents == CONTENT_LIGHT){ //use 0 to allow infinite hits
+ }else if(hit_counter == 1){
+ sprite->set_action("empty");
+ }else{
+ hit_counter--;
++>>>>>>> feature/sdl2
}
}
return;
state = STATE_EXPLODING;
- set_action("default", 1); //TODO: the less-threatening short_fuse explosion should look less-threatening
+ set_action(hurt ? "default" : "pop", 1);
sprite->set_animation_loops(1); //TODO: this is necessary because set_action will not set "loops" when "action" is the default action
- if (hurt)
- sound_manager->play("sounds/explosion.wav", get_pos());
- else
- sound_manager->play("sounds/firecracker.ogg", get_pos());
-
+ sprite->set_angle(graphicsRandom.randf(0, 360)); // a random rotation on the sprite to make explosions appear more random
- sound_manager->play(hurt ? "sounds/explosion.wav" : "sounds/firecracker.ogg", get_pos());
-
++ sound_manager->play(hurt ? "sounds/explosion.wav" : "sounds/firecracker.ogg", get_pos());
#if 0
// spawn some particles