}
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(),
}
/* 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()
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)
{
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);
} // 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
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{
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");