Sprite* smalltux_star;
Sprite* largetux_star;
-Sprite* smalltux_stand_left;
-Sprite* smalltux_stand_right;
-Sprite* smalltux_walk_right;
-Sprite* smalltux_walk_left;
-Sprite* smalltux_jump_left;
-Sprite* smalltux_jump_right;
-Sprite* smalltux_kick_left;
-Sprite* smalltux_kick_right;
-Sprite* smalltux_skid_left;
-Sprite* smalltux_skid_right;
-Sprite* smalltux_grab_left;
-Sprite* smalltux_grab_right;
-
-Sprite* largetux_stand_left;
-Sprite* largetux_stand_right;
-Sprite* largetux_walk_right;
-Sprite* largetux_walk_left;
-Sprite* largetux_jump_right;
-Sprite* largetux_jump_left;
-Sprite* largetux_kick_left;
-Sprite* largetux_kick_right;
-Sprite* largetux_skid_right;
-Sprite* largetux_skid_left;
-Sprite* largetux_grab_left;
-Sprite* largetux_grab_right;
-Sprite* largetux_duck_right;
-Sprite* largetux_duck_left;
+PlayerSprite smalltux;
+PlayerSprite largetux;
Surface* firetux_right[3];
Surface* firetux_left[3];
if (physic.get_velocity_y() != 0)
{
if (dir == RIGHT)
- smalltux_jump_right->draw(base.x - scroll_x, base.y);
+ smalltux.jump_right->draw(base.x - scroll_x, base.y);
else
- smalltux_jump_left->draw(base.x - scroll_x, base.y);
+ smalltux.jump_left->draw(base.x - scroll_x, base.y);
}
else
{
if (fabsf(physic.get_velocity_x()) < 1.0f) // standing
{
if (dir == RIGHT)
- smalltux_stand_right->draw( base.x - scroll_x, base.y - 9);
+ smalltux.stand_right->draw( base.x - scroll_x, base.y - 9);
else
- smalltux_stand_left->draw( base.x - scroll_x, base.y - 9);
+ smalltux.stand_left->draw( base.x - scroll_x, base.y - 9);
}
else // moving
{
if (dir == RIGHT)
- smalltux_walk_right->draw(base.x - scroll_x, base.y);
+ smalltux.walk_right->draw(base.x - scroll_x, base.y);
else
- smalltux_walk_left->draw(base.x - scroll_x, base.y);
+ smalltux.walk_left->draw(base.x - scroll_x, base.y);
}
}
}
else
{
if (dir == RIGHT)
- smalltux_skid_right->draw(base.x - scroll_x, base.y);
+ smalltux.skid_right->draw(base.x - scroll_x, base.y);
else
- smalltux_skid_left->draw(base.x - scroll_x, base.y);
+ smalltux.skid_left->draw(base.x - scroll_x, base.y);
}
if (holding_something && physic.get_velocity_y() == 0)
{
if (dir == RIGHT)
- smalltux_grab_right->draw(base.x - scroll_x, base.y);
+ smalltux.grab_right->draw(base.x - scroll_x, base.y);
else
- smalltux_grab_left->draw(base.x - scroll_x, base.y);
+ smalltux.grab_left->draw(base.x - scroll_x, base.y);
}
if (invincible_timer.started())
if (fabsf(physic.get_velocity_x()) < 1.0f) // standing
{
if (dir == RIGHT)
- largetux_stand_right->draw(base.x - scroll_x, base.y);
+ largetux.stand_right->draw(base.x - scroll_x, base.y);
else
- largetux_stand_left->draw(base.x - scroll_x, base.y);
+ largetux.stand_left->draw(base.x - scroll_x, base.y);
}
else // walking
{
if (dir == RIGHT)
- largetux_walk_right->draw(base.x - scroll_x, base.y);
+ largetux.walk_right->draw(base.x - scroll_x, base.y);
else
- largetux_walk_left->draw(base.x - scroll_x, base.y);
+ largetux.walk_left->draw(base.x - scroll_x, base.y);
}
}
else
{
if (dir == RIGHT)
- largetux_jump_right->draw(base.x - scroll_x, base.y);
+ largetux.jump_right->draw(base.x - scroll_x, base.y);
else
- largetux_jump_left->draw(base.x - scroll_x, base.y);
+ largetux.jump_left->draw(base.x - scroll_x, base.y);
}
}
else
{
if (dir == RIGHT)
- largetux_skid_right->draw(base.x - scroll_x - 8, base.y);
+ largetux.skid_right->draw(base.x - scroll_x - 8, base.y);
else
- largetux_skid_left->draw(base.x - scroll_x - 8, base.y);
+ largetux.skid_left->draw(base.x - scroll_x - 8, base.y);
}
}
else
{
if (dir == RIGHT)
- largetux_duck_right->draw(base.x - scroll_x, base.y);
+ largetux.duck_right->draw(base.x - scroll_x, base.y);
else
- largetux_duck_left->draw(base.x - scroll_x, base.y);
+ largetux.duck_left->draw(base.x - scroll_x, base.y);
}
}
else
if (holding_something && !duck && physic.get_velocity_y() == 0)
{
if (dir == RIGHT)
- largetux_grab_right->draw(base.x - scroll_x, base.y);
+ largetux.grab_right->draw(base.x - scroll_x, base.y);
else
- largetux_grab_left->draw(base.x - scroll_x, base.y);
+ largetux.grab_left->draw(base.x - scroll_x, base.y);
}
if (invincible_timer.started())
extern Sprite* smalltux_star;
extern Sprite* largetux_star;
-extern Sprite* smalltux_stand_left;
-extern Sprite* smalltux_stand_right;
-extern Sprite* smalltux_walk_right;
-extern Sprite* smalltux_walk_left;
-extern Sprite* smalltux_jump_left;
-extern Sprite* smalltux_jump_right;
-extern Sprite* smalltux_kick_left;
-extern Sprite* smalltux_kick_right;
-extern Sprite* smalltux_skid_left;
-extern Sprite* smalltux_skid_right;
-extern Sprite* smalltux_grab_left;
-extern Sprite* smalltux_grab_right;
-
-extern Sprite* largetux_stand_left;
-extern Sprite* largetux_stand_right;
-extern Sprite* largetux_walk_right;
-extern Sprite* largetux_walk_left;
-extern Sprite* largetux_jump_right;
-extern Sprite* largetux_jump_left;
-extern Sprite* largetux_kick_left;
-extern Sprite* largetux_kick_right;
-extern Sprite* largetux_skid_right;
-extern Sprite* largetux_skid_left;
-extern Sprite* largetux_grab_left;
-extern Sprite* largetux_grab_right;
-extern Sprite* largetux_duck_right;
-extern Sprite* largetux_duck_left;
+struct PlayerSprite
+{
+ Sprite* stand_left;
+ Sprite* stand_right;
+ Sprite* walk_right;
+ Sprite* walk_left;
+ Sprite* jump_right;
+ Sprite* jump_left;
+ Sprite* kick_left;
+ Sprite* kick_right;
+ Sprite* skid_right;
+ Sprite* skid_left;
+ Sprite* grab_left;
+ Sprite* grab_right;
+ Sprite* duck_right;
+ Sprite* duck_left;
+};
+
+extern PlayerSprite smalltux;
+extern PlayerSprite largetux;
extern Surface* firetux_right[3];
extern Surface* firetux_left[3];
largetux_star = sprite_manager->load("largetux-star");
smalltux_gameover = sprite_manager->load("smalltux-gameover");
- smalltux_stand_left = sprite_manager->load("smalltux-stand-left");
- smalltux_stand_right = sprite_manager->load("smalltux-stand-right");
- smalltux_walk_left = sprite_manager->load("smalltux-walk-left");
- smalltux_walk_right = sprite_manager->load("smalltux-walk-right");
- smalltux_jump_left = sprite_manager->load("smalltux-jump-left");
- smalltux_jump_right = sprite_manager->load("smalltux-jump-right");
- smalltux_kick_left = sprite_manager->load("smalltux-kick-left");
- smalltux_kick_right = sprite_manager->load("smalltux-kick-right");
- smalltux_skid_left = sprite_manager->load("smalltux-skid-left");
- smalltux_skid_right = sprite_manager->load("smalltux-skid-right");
- smalltux_grab_left = sprite_manager->load("smalltux-grab-left");
- smalltux_grab_right = sprite_manager->load("smalltux-grab-right");
-
- largetux_stand_left = sprite_manager->load("largetux-stand-left");
- largetux_stand_right = sprite_manager->load("largetux-stand-right");
- largetux_walk_left = sprite_manager->load("largetux-walk-left");
- largetux_walk_right = sprite_manager->load("largetux-walk-right");
- largetux_jump_left = sprite_manager->load("largetux-jump-left");
- largetux_jump_right = sprite_manager->load("largetux-jump-right");
- largetux_kick_left = sprite_manager->load("largetux-kick-left");
- largetux_kick_right = sprite_manager->load("largetux-kick-right");
- largetux_skid_right = sprite_manager->load("largetux-skid-right");
- largetux_skid_left = sprite_manager->load("largetux-skid-left");
- largetux_grab_left = sprite_manager->load("largetux-grab-left");
- largetux_grab_right = sprite_manager->load("largetux-grab-right");
- largetux_duck_left = sprite_manager->load("largetux-duck-left");
- largetux_duck_right = sprite_manager->load("largetux-duck-right");
+ smalltux.stand_left = sprite_manager->load("smalltux-stand-left");
+ smalltux.stand_right = sprite_manager->load("smalltux-stand-right");
+ smalltux.walk_left = sprite_manager->load("smalltux-walk-left");
+ smalltux.walk_right = sprite_manager->load("smalltux-walk-right");
+ smalltux.jump_left = sprite_manager->load("smalltux-jump-left");
+ smalltux.jump_right = sprite_manager->load("smalltux-jump-right");
+ smalltux.kick_left = sprite_manager->load("smalltux-kick-left");
+ smalltux.kick_right = sprite_manager->load("smalltux-kick-right");
+ smalltux.skid_left = sprite_manager->load("smalltux-skid-left");
+ smalltux.skid_right = sprite_manager->load("smalltux-skid-right");
+ smalltux.grab_left = sprite_manager->load("smalltux-grab-left");
+ smalltux.grab_right = sprite_manager->load("smalltux-grab-right");
+
+ largetux.stand_left = sprite_manager->load("largetux-stand-left");
+ largetux.stand_right = sprite_manager->load("largetux-stand-right");
+ largetux.walk_left = sprite_manager->load("largetux-walk-left");
+ largetux.walk_right = sprite_manager->load("largetux-walk-right");
+ largetux.jump_left = sprite_manager->load("largetux-jump-left");
+ largetux.jump_right = sprite_manager->load("largetux-jump-right");
+ largetux.kick_left = sprite_manager->load("largetux-kick-left");
+ largetux.kick_right = sprite_manager->load("largetux-kick-right");
+ largetux.skid_right = sprite_manager->load("largetux-skid-right");
+ largetux.skid_left = sprite_manager->load("largetux-skid-left");
+ largetux.grab_left = sprite_manager->load("largetux-grab-left");
+ largetux.grab_right = sprite_manager->load("largetux-grab-right");
+ largetux.duck_left = sprite_manager->load("largetux-duck-left");
+ largetux.duck_right = sprite_manager->load("largetux-duck-right");
duckfiretux_right = new Surface(datadir +
"/images/shared/duckfiretux-right.png",