From: LMH Date: Sat, 13 Jul 2013 07:03:41 +0000 (-1000) Subject: Reduced code for HeavyCoin used by CoinRain, correcting unusual coin behavior introdu... X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=c0b1f81b0b036a91b06c964d4a47e956224b7cca;p=supertux.git Reduced code for HeavyCoin used by CoinRain, correcting unusual coin behavior introduced in commit 4ed4ca8 --- diff --git a/src/object/coin.cpp b/src/object/coin.cpp index b381473f3..a1eea594f 100644 --- a/src/object/coin.cpp +++ b/src/object/coin.cpp @@ -53,7 +53,7 @@ Coin::Coin(const Vector& pos, TileMap* tilemap) } Coin::Coin(const Reader& reader) - : MovingSprite(reader, "images/objects/coin/coin.sprite", LAYER_TILES, COLGROUP_MOVING), + : MovingSprite(reader, "images/objects/coin/coin.sprite", LAYER_TILES, COLGROUP_TOUCHABLE), path(), walker(), offset(), @@ -173,14 +173,6 @@ Coin::collision(GameObject& other, const CollisionHit& ) } /* The following defines a coin subject to gravity */ -HeavyCoin::HeavyCoin(const Vector& pos) - : Coin(pos), - physic() -{ - physic.enable_gravity(true); - sound_manager->preload("sounds/coin.wav"); -} - HeavyCoin::HeavyCoin(const Vector& pos, const Vector& init_velocity) : Coin(pos), physic() @@ -190,14 +182,6 @@ HeavyCoin::HeavyCoin(const Vector& pos, const Vector& init_velocity) physic.set_velocity(init_velocity); } -HeavyCoin::HeavyCoin(const Reader& reader) - : Coin(reader), - physic() -{ - physic.enable_gravity(true); - sound_manager->preload("sounds/coin.wav"); -} - void HeavyCoin::update(float elapsed_time) { diff --git a/src/object/coin.hpp b/src/object/coin.hpp index 91f3bcd50..ba517f7e7 100644 --- a/src/object/coin.hpp +++ b/src/object/coin.hpp @@ -47,9 +47,7 @@ private: class HeavyCoin : public Coin { public: - HeavyCoin(const Vector& pos); 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); diff --git a/src/object/coin_rain.cpp b/src/object/coin_rain.cpp index 42b1317e5..41f4529df 100644 --- a/src/object/coin_rain.cpp +++ b/src/object/coin_rain.cpp @@ -50,7 +50,7 @@ CoinRain::update(float elapsed_time) } // then the first collectable coin drops from one of ten random positions else if (counter==0){ drop = gameRandom.rand(10); - Sector::current()->add_object(new HeavyCoin(Vector (position.x+32*((drop<5)?-drop-1:drop-4),-32))); + Sector::current()->add_object(new HeavyCoin(Vector (position.x+32*((drop<5)?-drop-1:drop-4),-32), Vector (0,0))); counter++; timer.start(DROP_TIME); } // finally the remainder of the coins drop in a determined but appears to be a random order @@ -58,7 +58,7 @@ CoinRain::update(float elapsed_time) if(counter<10){ drop += 7; if(drop >= 10) drop -=10; - Sector::current()->add_object(new HeavyCoin(Vector (position.x+32*((drop<5)?-drop-1:drop-4),-32))); + Sector::current()->add_object(new HeavyCoin(Vector (position.x+32*((drop<5)?-drop-1:drop-4),-32), Vector (0,0))); counter++; timer.start(DROP_TIME); }else{ diff --git a/src/supertux/object_factory.cpp b/src/supertux/object_factory.cpp index fc01e111d..318389fa1 100644 --- a/src/supertux/object_factory.cpp +++ b/src/supertux/object_factory.cpp @@ -232,7 +232,6 @@ ObjectFactory::init_factories() add_factory("explosion"); add_factory("firefly"); add_factory("gradient"); - add_factory("heavycoin"); add_factory("hurting_platform"); add_factory("icecrusher"); add_factory("infoblock");