#include "object/portable.hpp"
#include "object/specialriser.hpp"
#include "object/star.hpp"
+#include "object/trampoline.hpp"
#include "sprite/sprite_manager.hpp"
#include "supertux/constants.hpp"
#include "supertux/level.hpp"
contents(),
object(0),
hit_counter(1),
- lightsprite(Surface::create("/images/objects/lightmap_light/bonusblock_light.png"))
+ lightsprite()
{
bbox.set_pos(pos);
sprite->set_action("normal");
case 3: contents = CONTENT_STAR; break;
case 4: contents = CONTENT_1UP; break;
case 5: contents = CONTENT_ICEGROW; break;
- case 6: contents = CONTENT_LIGHT; sound_manager->preload("sounds/switch.ogg"); break;
+ case 6: contents = CONTENT_LIGHT;
+ sound_manager->preload("sounds/switch.ogg");
+ lightsprite=Surface::create("/images/objects/lightmap_light/bonusblock_light.png");
+ break;
+ case 7: contents = CONTENT_TRAMPOLINE; break;
+ case 8: contents = CONTENT_PORTTRAMPOLINE; break;
+ case 9: contents = CONTENT_ROCK; break;
default:
log_warning << "Invalid box contents" << std::endl;
contents = CONTENT_COIN;
contents(),
object(0),
hit_counter(1),
- lightsprite(Surface::create("/images/objects/lightmap_light/bonusblock_light.png"))
+ lightsprite()
{
Vector pos;
} else if(contentstring == "light") {
contents = CONTENT_LIGHT;
sound_manager->preload("sounds/switch.ogg");
+ } else if(contentstring == "trampoline") {
+ contents = CONTENT_TRAMPOLINE;
+ } else if(contentstring == "porttrampoline") {
+ contents = CONTENT_PORTTRAMPOLINE;
+ } else if(contentstring == "rock") {
+ contents = CONTENT_ROCK;
} else {
log_warning << "Invalid box contents '" << contentstring << "'" << std::endl;
}
if(contents == CONTENT_CUSTOM && object == 0)
throw std::runtime_error("Need to specify content object for custom block");
+ if(contents == CONTENT_LIGHT)
+ lightsprite = Surface::create("/images/objects/lightmap_light/bonusblock_light.png");
bbox.set_pos(pos);
}
else
sprite->set_action("on");
sound_manager->play("sounds/switch.ogg");
+ break;
+ }
+ case CONTENT_TRAMPOLINE:
+ {
+ SpecialRiser* riser = new SpecialRiser(get_pos(), new Trampoline(get_pos(), false));
+ sector->add_object(riser);
+ sound_manager->play("sounds/upgrade.wav");
+ break;
+ }
+ case CONTENT_PORTTRAMPOLINE:
+ {
+ SpecialRiser* riser = new SpecialRiser(get_pos(), new Trampoline(get_pos(), true));
+ sector->add_object(riser);
+ sound_manager->play("sounds/upgrade.wav");
+ break;
+ }
+ case CONTENT_ROCK:
+ {
+ SpecialRiser* riser = new SpecialRiser(get_pos(),
+ new Rock(get_pos(), "images/objects/rock/rock.sprite"));
+ sector->add_object(riser);
+ sound_manager->play("sounds/upgrade.wav");
+ break;
}
}