5 #include "video/drawing_context.h"
6 #include "special/sprite_manager.h"
9 #include "player_status.h"
11 #include "statistics.h"
12 #include "object_factory.h"
14 Coin::Coin(const Vector& pos)
17 bbox.set_size(32, 32);
18 sprite = sprite_manager->create("coin");
21 Coin::Coin(const lisp::Lisp& reader)
23 reader.get("x", bbox.p1.x);
24 reader.get("y", bbox.p1.y);
25 bbox.set_size(32, 32);
26 sprite = sprite_manager->create("coin");
40 Coin::draw(DrawingContext& context)
42 sprite->draw(context, get_pos(), LAYER_TILES);
48 Sector::current()->player->get_status().incCoins();
49 Sector::current()->add_object(new BouncyCoin(get_pos()));
50 global_stats.add_points(COINS_COLLECTED_STAT, 1);
55 Coin::collision(GameObject& other, const CollisionHit& )
57 Player* player = dynamic_cast<Player*>(&other);
65 IMPLEMENT_FACTORY(Coin, "coin");