Tweaks to HeavyCoin to make it placeable in the editor
authorLMH <lmh.0013@gmail.com>
Tue, 13 Aug 2013 22:36:29 +0000 (12:36 -1000)
committerLMH <lmh.0013@gmail.com>
Tue, 13 Aug 2013 22:36:29 +0000 (12:36 -1000)
(just in case)

src/object/coin.cpp
src/object/coin.hpp
src/supertux/object_factory.cpp

index 37becc0..86e4dd8 100644 (file)
@@ -26,7 +26,7 @@
 #include "supertux/sector.hpp"
 
 Coin::Coin(const Vector& pos)
-  : MovingSprite(pos, "images/objects/coin/coin.sprite", LAYER_TILES, COLGROUP_MOVING),
+  : MovingSprite(pos, "images/objects/coin/coin.sprite", LAYER_TILES, COLGROUP_TOUCHABLE),
     path(),
     walker(),
     offset(),
@@ -179,9 +179,19 @@ HeavyCoin::HeavyCoin(const Vector& pos, const Vector& init_velocity)
 {
   physic.enable_gravity(true);
   sound_manager->preload("sounds/coin.wav");
+  set_group(COLGROUP_MOVING);
   physic.set_velocity(init_velocity);
 }
 
+HeavyCoin::HeavyCoin(const Reader& reader)
+  : Coin(reader),
+  physic()
+{
+  physic.enable_gravity(true);
+  sound_manager->preload("sounds/coin.wav");
+  set_group(COLGROUP_MOVING);
+}
+
 void
 HeavyCoin::update(float elapsed_time)
 {
index ba517f7..132a472 100644 (file)
@@ -48,6 +48,7 @@ class HeavyCoin : public Coin
 {
 public:
   HeavyCoin(const Vector& pos, const Vector& init_velocity);
+  HeavyCoin(const Reader& reader);
 
   virtual void update(float elapsed_time);
   virtual void collision_solid(const CollisionHit& hit);
index 096e82a..2165970 100644 (file)
@@ -244,6 +244,7 @@ ObjectFactory::init_factories()
   add_factory<Explosion>("explosion");
   add_factory<Firefly>("firefly");
   add_factory<Gradient>("gradient");
+  add_factory<HeavyCoin>("heavycoin");
   add_factory<HurtingPlatform>("hurting_platform");
   add_factory<IceCrusher>("icecrusher");
   add_factory<InfoBlock>("infoblock");