patch contributed by markos_64:
[supertux.git] / src / badguy / bouncing_snowball.cpp
index 16dd18f..26a9534 100644 (file)
@@ -11,14 +11,17 @@ BouncingSnowball::BouncingSnowball(LispReader& reader)
   reader.read_float("y", start_position.y);
   bbox.set_size(31.8, 31.8);
   sprite = sprite_manager->create("bouncingsnowball");
+  set_direction = false;
 }
 
-BouncingSnowball::BouncingSnowball(float pos_x, float pos_y)
+BouncingSnowball::BouncingSnowball(float pos_x, float pos_y, Direction d)
 {
    start_position.x = pos_x;
    start_position.y = pos_y;
    bbox.set_size(31.8, 31.8);
    sprite = sprite_manager->create("bouncingsnowball");
+   set_direction = true;
+   initial_direction = d;
 }
 
 void
@@ -35,6 +38,7 @@ BouncingSnowball::write(LispWriter& writer)
 void
 BouncingSnowball::activate()
 {
+  if (set_direction) {dir = initial_direction;}
   physic.set_velocity_x(dir == LEFT ? -WALKSPEED : WALKSPEED);
   sprite->set_action(dir == LEFT ? "left" : "right");
 }