int i;
/* Tuxes: */
- texture_load(&tux_right[0], datadir + "/images/shared/tux-right-0.png", USE_ALPHA);
- texture_load(&tux_right[1], datadir + "/images/shared/tux-right-1.png", USE_ALPHA);
- texture_load(&tux_right[2], datadir + "/images/shared/tux-right-2.png", USE_ALPHA);
-
- texture_load(&tux_left[0], datadir + "/images/shared/tux-left-0.png", USE_ALPHA);
- texture_load(&tux_left[1], datadir + "/images/shared/tux-left-1.png", USE_ALPHA);
- texture_load(&tux_left[2], datadir + "/images/shared/tux-left-2.png", USE_ALPHA);
+ texture_load(&smalltux_stand_left, datadir + "/images/shared/smalltux-left-6.png", USE_ALPHA);
+ texture_load(&smalltux_stand_right, datadir + "/images/shared/smalltux-right-6.png", USE_ALPHA);
+
+ texture_load(&smalltux_jump_left, datadir + "/images/shared/smalltux-jump-left.png", USE_ALPHA);
+ texture_load(&smalltux_jump_right, datadir + "/images/shared/smalltux-jump-right.png", USE_ALPHA);
+
+ tux_right.resize(8);
+ texture_load(&tux_right[0], datadir + "/images/shared/smalltux-right-1.png", USE_ALPHA);
+ texture_load(&tux_right[1], datadir + "/images/shared/smalltux-right-2.png", USE_ALPHA);
+ texture_load(&tux_right[2], datadir + "/images/shared/smalltux-right-3.png", USE_ALPHA);
+ texture_load(&tux_right[3], datadir + "/images/shared/smalltux-right-4.png", USE_ALPHA);
+ texture_load(&tux_right[4], datadir + "/images/shared/smalltux-right-5.png", USE_ALPHA);
+ texture_load(&tux_right[5], datadir + "/images/shared/smalltux-right-6.png", USE_ALPHA);
+ texture_load(&tux_right[6], datadir + "/images/shared/smalltux-right-7.png", USE_ALPHA);
+ texture_load(&tux_right[7], datadir + "/images/shared/smalltux-right-8.png", USE_ALPHA);
+
+ tux_left.resize(8);
+ texture_load(&tux_left[0], datadir + "/images/shared/smalltux-left-1.png", USE_ALPHA);
+ texture_load(&tux_left[1], datadir + "/images/shared/smalltux-left-2.png", USE_ALPHA);
+ texture_load(&tux_left[2], datadir + "/images/shared/smalltux-left-3.png", USE_ALPHA);
+ texture_load(&tux_left[3], datadir + "/images/shared/smalltux-left-4.png", USE_ALPHA);
+ texture_load(&tux_left[4], datadir + "/images/shared/smalltux-left-5.png", USE_ALPHA);
+ texture_load(&tux_left[5], datadir + "/images/shared/smalltux-left-6.png", USE_ALPHA);
+ texture_load(&tux_left[6], datadir + "/images/shared/smalltux-left-7.png", USE_ALPHA);
+ texture_load(&tux_left[7], datadir + "/images/shared/smalltux-left-8.png", USE_ALPHA);
texture_load(&firetux_right[0], datadir + "/images/shared/firetux-right-0.png", USE_ALPHA);
texture_load(&firetux_right[1], datadir + "/images/shared/firetux-right-1.png", USE_ALPHA);
#include "screen.h"
texture_type tux_life;
-texture_type tux_right[3];
-texture_type tux_left[3];
+std::vector<texture_type> tux_right;
+std::vector<texture_type> tux_left;
+texture_type smalltux_jump_left;
+texture_type smalltux_jump_right;
+texture_type smalltux_stand_left;
+texture_type smalltux_stand_right;
+
texture_type bigtux_right[3];
texture_type bigtux_left[3];
texture_type bigtux_right_jump;
if (!got_coffee)
{
- if (dir == RIGHT)
+ if (physic.get_velocity_y() > 0)
{
- texture_draw(&tux_right[frame_], base.x- scroll_x, base.y);
+ if (dir == RIGHT)
+ texture_draw(&smalltux_jump_right, base.x - scroll_x, base.y - 10);
+ else
+ texture_draw(&smalltux_jump_left, base.x - scroll_x, base.y - 10);
}
else
{
- texture_draw(&tux_left[frame_], base.x- scroll_x, base.y);
+ if (fabsf(physic.get_velocity_x()) < 1.0f) // standing
+ {
+ if (dir == RIGHT)
+ texture_draw(&smalltux_stand_right, base.x - scroll_x, base.y - 9);
+ else
+ texture_draw(&smalltux_stand_left, base.x - scroll_x, base.y - 9);
+ }
+ else // moving
+ {
+ if (dir == RIGHT)
+ texture_draw(&tux_right[(global_frame_counter/2) % tux_right.size()],
+ base.x - scroll_x, base.y - 9);
+ else
+ texture_draw(&tux_left[(global_frame_counter/2) % tux_left.size()],
+ base.x - scroll_x, base.y - 9);
+ }
}
}
else
#define SCORE_BRICK 5
#define SCORE_DISTRO 25
+#include <vector>
+
struct player_keymap_type
{
int jump;
void player_input_init(player_input_type* pplayer_input);
extern texture_type tux_life;
-extern texture_type tux_right[3];
-extern texture_type tux_left[3];
+extern std::vector<texture_type> tux_right;
+extern std::vector<texture_type> tux_left;
+extern texture_type smalltux_jump_left;
+extern texture_type smalltux_jump_right;
+extern texture_type smalltux_stand_left;
+extern texture_type smalltux_stand_right;
extern texture_type bigtux_right[3];
extern texture_type bigtux_left[3];
extern texture_type bigtux_right_jump;