Sprite* img_snowball_squished_left;
Sprite* img_snowball_squished_right;
+#define BADGUY_WALK_SPEED .8f
+
BadGuyKind badguykind_from_string(const std::string& str)
{
if (str == "money")
timer.init(true);
if(kind == BAD_BSOD) {
- physic.set_velocity(-1.3, 0);
+ physic.set_velocity(-BADGUY_WALK_SPEED, 0);
set_sprite(img_bsod_left, img_bsod_right);
} else if(kind == BAD_MRBOMB) {
- physic.set_velocity(-1.3, 0);
+ physic.set_velocity(-BADGUY_WALK_SPEED, 0);
set_sprite(img_mrbomb_left, img_mrbomb_right);
} else if (kind == BAD_LAPTOP) {
- physic.set_velocity(-.8, 0);
+ physic.set_velocity(-BADGUY_WALK_SPEED, 0);
set_sprite(img_laptop_left, img_laptop_right);
} else if(kind == BAD_MONEY) {
set_sprite(img_jumpy_left_up, img_jumpy_left_up);
physic.enable_gravity(false);
set_sprite(img_flame, img_flame);
} else if(kind == BAD_BOUNCINGSNOWBALL) {
- physic.set_velocity(-1.3, 0);
+ physic.set_velocity(-BADGUY_WALK_SPEED, 0);
set_sprite(img_bouncingsnowball_left, img_bouncingsnowball_right);
} else if(kind == BAD_STALACTITE) {
physic.enable_gravity(false);
set_sprite(img_flyingsnowball, img_flyingsnowball);
physic.enable_gravity(false);
} else if(kind == BAD_SPIKY) {
- physic.set_velocity(-1.3, 0);
+ physic.set_velocity(-BADGUY_WALK_SPEED, 0);
set_sprite(img_spiky_left, img_spiky_right);
} else if(kind == BAD_SNOWBALL) {
- physic.set_velocity(-1.3, 0);
+ physic.set_velocity(-BADGUY_WALK_SPEED, 0);
set_sprite(img_snowball_left, img_snowball_right);
}
Sprite* smalltux_gameover;
Sprite* smalltux_skid_left;
Sprite* smalltux_skid_right;
+Sprite* largetux_stand_left;
+Sprite* largetux_stand_right;
Sprite* bigtux_right;
Sprite* bigtux_left;
{
if (physic.get_velocity_y() == 0)
{
- if (dir == RIGHT)
- bigtux_right->draw(base.x - scroll_x, base.y);
- else
- bigtux_left->draw(base.x - scroll_x, base.y);
+ if (fabsf(physic.get_velocity_x()) < 1.0f) // standing
+ {
+ if (dir == RIGHT)
+ largetux_stand_right->draw(base.x - scroll_x, base.y);
+ else
+ largetux_stand_left->draw(base.x - scroll_x, base.y);
+ }
+ else // walking
+ {
+ if (dir == RIGHT)
+ bigtux_right->draw(base.x - scroll_x, base.y);
+ else
+ bigtux_left->draw(base.x - scroll_x, base.y);
+ }
}
else
{
extern Sprite* smalltux_skid_left;
extern Sprite* smalltux_skid_right;
extern Sprite* smalltux_gameover;
+extern Sprite* largetux_stand_left;
+extern Sprite* largetux_stand_right;
extern Sprite* bigtux_right;
extern Sprite* bigtux_left;
extern Sprite* bigtux_right_jump;