From: LMH Date: Tue, 13 Aug 2013 22:36:29 +0000 (-1000) Subject: Tweaks to HeavyCoin to make it placeable in the editor X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=ca395d3754a388c4824b46086e7d29711a5d4752;p=supertux.git Tweaks to HeavyCoin to make it placeable in the editor (just in case) --- diff --git a/src/object/coin.cpp b/src/object/coin.cpp index 37becc046..86e4dd8aa 100644 --- a/src/object/coin.cpp +++ b/src/object/coin.cpp @@ -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) { diff --git a/src/object/coin.hpp b/src/object/coin.hpp index ba517f7e7..132a472d3 100644 --- a/src/object/coin.hpp +++ b/src/object/coin.hpp @@ -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); diff --git a/src/supertux/object_factory.cpp b/src/supertux/object_factory.cpp index 096e82a8d..2165970c2 100644 --- a/src/supertux/object_factory.cpp +++ b/src/supertux/object_factory.cpp @@ -244,6 +244,7 @@ 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");