Surface* img_iceflower;
Surface* img_1up;
+#define GROWUP_SPEED 1.0f
+
void
Bullet::init(float x, float y, float xm, int dir)
{
}
void
-Upgrade::init(float x_, float y_, int dir_, int kind_)
+Upgrade::init(float x_, float y_, int dir_, UpgradeKind kind_)
{
kind = kind_;
dir = dir_;
base.height = 32;
} else if (kind == UPGRADE_ICEFLOWER) {
// nothing
+ } else if (kind == UPGRADE_GROWUP) {
+ physic.set_velocity(dir == LEFT ? -GROWUP_SPEED : GROWUP_SPEED, 0);
} else {
physic.set_velocity(dir == LEFT ? -2 : 2, 0);
}
old_base = base;
if(kind == UPGRADE_GROWUP) {
physic.enable_gravity(false);
- physic.set_velocity(dir == LEFT ? -2 : 2, 0);
+ physic.set_velocity(dir == LEFT ? -GROWUP_SPEED : GROWUP_SPEED, 0);
} else if(kind == UPGRADE_HERRING) {
physic.set_velocity(dir == LEFT ? -2 : 2, 3);
}
/* Upgrade types: */
-enum {
+enum UpgradeKind {
UPGRADE_GROWUP,
UPGRADE_ICEFLOWER,
UPGRADE_HERRING,
class Upgrade
{
public:
- int kind;
+ UpgradeKind kind;
int dir;
base_type base;
base_type old_base;
Physic physic;
- void init(float x, float y, int dir, int kind);
+ void init(float x, float y, int dir, UpgradeKind kind);
void action(double frame_ratio);
void draw();
void collision(void* p_c_object, int c_object);
}
void
-World::add_upgrade(float x, float y, int dir, int kind)
+World::add_upgrade(float x, float y, int dir, UpgradeKind kind)
{
Upgrade new_upgrade;
new_upgrade.init(x,y,dir,kind);
void add_broken_brick_piece(Tile* tile, float x, float y, float xm, float ym);
void add_bouncy_brick(float x, float y);
void add_bad_guy(float x, float y, BadGuyKind kind);
- void add_upgrade(float x, float y, int dir, int kind);
+ void add_upgrade(float x, float y, int dir, UpgradeKind kind);
void add_bullet(float x, float y, float xm, int dir);
/** Try to grab the coin at the given coordinates */