-#include "tile.h"
-#include "tile_manager.h"
-#include "game_session.h"
-#include "gameobjs.h"
-#include "sprite/sprite_manager.h"
-#include "resources.h"
-#include "sector.h"
-#include "tilemap.h"
-#include "video/drawing_context.h"
-#include "camera.h"
-#include "main.h"
-
-BouncyCoin::BouncyCoin(const Vector& pos)
- : position(pos)
-{
- timer.start(.3);
- sprite = sprite_manager->create("coin");
- sprite->set_action("still");
+#include "tile.hpp"
+#include "tile_manager.hpp"
+#include "game_session.hpp"
+#include "gameobjs.hpp"
+#include "sprite/sprite_manager.hpp"
+#include "sprite/sprite.hpp"
+#include "resources.hpp"
+#include "sector.hpp"
+#include "tilemap.hpp"
+#include "video/drawing_context.hpp"
+#include "camera.hpp"
+#include "main.hpp"
+#include "random_generator.hpp"
+
+/** this controls the time over which a bouncy coin fades */
+static const float FADE_TIME = .2f;
+/** this is the total life time of a bouncy coin */
+static const float LIFE_TIME = .5f;
+
+BouncyCoin::BouncyCoin(const Vector& pos, bool emerge)
+ : position(pos), emerge_distance(0)
+{
+ timer.start(LIFE_TIME);
+ sprite = sprite_manager->create("images/objects/coin/coin.sprite");
+
+ if(emerge) {
+ emerge_distance = sprite->get_height();
+ }