(name "iced-right")
(hitbox 7 12 31.8 31.8)
(mirror-action "iced-left"))
-)
+ (action
+ (name "ticking-left")
+ (fps 2.0)
+ (hitbox 3 8 31.8 31.8)
+ (images "exploding-left-0.png"
+ "exploding-left-1.png"))
+
+ (action
+ (name "ticking-right")
+ (fps 2.0)
+ (hitbox 10 8 31.8 31.8)
+ (mirror-action "ticking-left"))
+
+ (action
+ (name "explosion")
+ (fps 15.0)
+ (hitbox 32 32 31.8 31.8)
+ (images "explosion-0.png"
+ "explosion-1.png"))
+)
#include "random_generator.hpp"
#include "object/sprite_particle.hpp"
-Bomb::Bomb(const Vector& pos, Direction dir)
- : BadGuy(pos, dir, "images/creatures/mr_cherry/cherry.sprite")
+Bomb::Bomb(const Vector& pos, Direction dir, std::string custom_sprite /*= "images/creatures/mr_cherry/cherry.sprite"*/ )
+ : BadGuy( pos, dir, custom_sprite )
{
state = STATE_TICKING;
set_action(dir == LEFT ? "ticking-left" : "ticking-right", 1);
class Bomb : public BadGuy
{
public:
- Bomb(const Vector& pos, Direction dir);
+ Bomb(const Vector& pos, Direction dir, std::string custom_sprite = "images/creatures/mr_cherry/cherry.sprite" );
Bomb(const Bomb& bomb);
void write(lisp::Writer& writer);
#include "mrbomb.hpp"
#include "bomb.hpp"
+#include "sprite/sprite_manager.hpp"
static const float WALKSPEED = 80;
MrBomb::MrBomb(const lisp::Lisp& reader)
: BadGuy(reader, "images/creatures/mr_cherry/mr_cherry.sprite")
{
+ //Check if we need another sprite
+ if( !reader.get( "sprite", sprite_name ) ){
+ return;
+ }
+ if( sprite_name == "" ){
+ sprite_name = "images/creatures/mr_cherry/mr_cherry.sprite";
+ return;
+ }
+ //Replace sprite
+ sprite = sprite_manager->create( sprite_name );
+ bbox.set_size(sprite->get_current_hitbox_width(), sprite->get_current_hitbox_height());
}
+/* MrBomb created by a despencer always gets default sprite atm.*/
MrBomb::MrBomb(const Vector& pos, Direction d)
: BadGuy(pos, d, "images/creatures/mr_cherry/mr_cherry.sprite")
{
MrBomb::collision_squished(Player& player)
{
remove_me();
- Sector::current()->add_object(new Bomb(get_pos(), dir));
+ Sector::current()->add_object(new Bomb(get_pos(), dir, sprite_name ));
kill_squished(player);
return true;
}
MrBomb::kill_fall()
{
remove_me();
- Bomb* bomb = new Bomb(get_pos(), dir);
+ Bomb* bomb = new Bomb(get_pos(), dir, sprite_name );
Sector::current()->add_object(bomb);
bomb->explode();
}