(supertux-sprite
(action
+ (name "right")
(fps 1)
(images
"firetux-helmet.png"
)
)
+ (action
+ (name "left")
+ (fps 1)
+ (mirror-action "right")
+ )
)
(supertux-sprite
(action
+ (name "default")
(images
"smoke-1.png"
"smoke-2.png"
Vector ppos = bbox.get_middle();
Vector pspeed = Vector(systemRandom.randf(-10, 10), 150);
Vector paccel = Vector(0,0);
- Sector::current()->add_object(new SpriteParticle("images/objects/particles/smoke.sprite", ppos, ANCHOR_MIDDLE, pspeed, paccel, LAYER_OBJECTS-1));
+ Sector::current()->add_object(new SpriteParticle("images/objects/particles/smoke.sprite", "default", ppos, ANCHOR_MIDDLE, pspeed, paccel, LAYER_OBJECTS-1));
puff_timer.start(systemRandom.randf(PUFF_INTERVAL_MIN, PUFF_INTERVAL_MAX));
}
}
Vector ppos = bbox.get_middle();
Vector pspeed = Vector(0, -150);
Vector paccel = Vector(0,0);
- Sector::current()->add_object(new SpriteParticle("images/objects/particles/smoke.sprite", ppos, ANCHOR_MIDDLE, pspeed, paccel, LAYER_BACKGROUNDTILES+2));
+ Sector::current()->add_object(new SpriteParticle("images/objects/particles/smoke.sprite", "default", ppos, ANCHOR_MIDDLE, pspeed, paccel, LAYER_BACKGROUNDTILES+2));
}
bool
Vector ppos = Vector((bbox.p1.x + bbox.p2.x) / 2, bbox.p1.y);
Vector pspeed = Vector(((dir==LEFT) ? +100 : -100), -300);
Vector paccel = Vector(0, 1000);
- Sector::current()->add_object(new SpriteParticle("images/objects/particles/firetux-helmet.sprite", ppos, ANCHOR_TOP, pspeed, paccel, LAYER_OBJECTS+1));
+ std::string action = (dir==LEFT)?"left":"right";
+ Sector::current()->add_object(new SpriteParticle("images/objects/particles/firetux-helmet.sprite", action, ppos, ANCHOR_TOP, pspeed, paccel, LAYER_OBJECTS-1));
}
player_status->max_fire_bullets = 0;
player_status->max_ice_bullets = 0;
-// $Id: rainsplash.cpp 3327 2006-04-13 15:02:40Z ravu_al_hemio $
+// $Id$
//
// SuperTux
// Copyright (C) 2006 Matthias Braun <matze@braunis.de>
#include "main.hpp"
#include "log.hpp"
-SpriteParticle::SpriteParticle(std::string sprite_name, Vector position, AnchorPoint anchor, Vector velocity, Vector acceleration, int drawing_layer)
+SpriteParticle::SpriteParticle(std::string sprite_name, std::string action, Vector position, AnchorPoint anchor, Vector velocity, Vector acceleration, int drawing_layer)
: position(position), velocity(velocity), acceleration(acceleration), drawing_layer(drawing_layer)
{
sprite = sprite_manager->create(sprite_name);
if (!sprite) throw std::runtime_error("Could not load sprite "+sprite_name);
- sprite->set_animation_loops(1);
+ sprite->set_action(action, 1);
this->position -= get_anchor_pos(sprite->get_current_hitbox(), anchor);
}
-// $Id: rainsplash.hpp 3327 2006-04-13 15:02:40Z ravu_al_hemio $
+// $Id$
//
// SuperTux
// Copyright (C) 2006 Matthias Braun <matze@braunis.de>
class SpriteParticle : public GameObject
{
public:
- SpriteParticle(std::string sprite_name, Vector position, AnchorPoint anchor, Vector velocity, Vector acceleration, int drawing_layer = LAYER_OBJECTS-1);
+ SpriteParticle(std::string sprite_name, std::string action, Vector position, AnchorPoint anchor, Vector velocity, Vector acceleration, int drawing_layer = LAYER_OBJECTS-1);
~SpriteParticle();
protected:
virtual void hit(Player& player);