// others stuff:
#define AUTOSCROLL_DEAD_INTERVAL 300
+// time before idle animation starts
+#define IDLE_TIME 2500
+
// growing animation
Surface* growingtux_left[GROWING_FRAMES];
Surface* growingtux_right[GROWING_FRAMES];
}
void
+TuxBodyParts::start_animation(int loops, std::string next_action)
+{
+head->start_animation(loops, next_action);
+body->start_animation(loops, next_action);
+arms->start_animation(loops, next_action);
+feet->start_animation(loops, next_action);
+}
+
+void
TuxBodyParts::draw(DrawingContext& context, const Vector& pos, int layer,
Uint32 drawing_effect)
{
kick_timer.init(true);
shooting_timer.init(true);
growing_timer.init(true);
+ idle_timer.init(true);
physic.reset();
}
int
Player::key_event(SDLKey key, int state)
{
+ idle_timer.start(IDLE_TIME);
+
if(key == keymap.right)
{
input.right = state;
safe_timer.init(true);
frame_timer.init(true);
growing_timer.init(true);
+ idle_timer.init(true);
physic.reset();
}
int layer = LAYER_OBJECTS - 1;
Vector pos = Vector(base.x, base.y);
- if ((!safe_timer.started() || growing_timer.started()) || (global_frame_counter % 2) == 0)
+ if ((!safe_timer.started() || growing_timer.started()) && (global_frame_counter % 2))
{
if (dying == DYING_SQUISHED)
{
else
tux_body->set_action("kick-left");
}
+ else if (butt_jump)
+ {
+ if (dir == RIGHT)
+ tux_body->set_action("buttjump-right");
+ else
+ tux_body->set_action("buttjump-left");
+ }
else if (physic.get_velocity_y() != 0)
{
if (dir == RIGHT)
}
}
}
-
+/*
+ if(idle_timer.get_left() < 0)
+ {
+ if (dir == RIGHT)
+ {
+ tux_body->set_action("idle-right");
+ tux_body->start_animation(1, "stand-right");
+ }
+ else
+ {
+ tux_body->set_action("idle-left");
+ tux_body->start_animation(1, "stand-left");
+ }
+ idle_timer.start(IDLE_TIME);
+ }
+*/
// Tux is holding something
if ((holding_something && physic.get_velocity_y() == 0) ||
shooting_timer.check() && !duck)
~TuxBodyParts() { };
void set_action(std::string action);
+ void start_animation(int loops, std::string next_action = "");
void draw(DrawingContext& context, const Vector& pos, int layer,
Uint32 drawing_effect = NONE_EFFECT);
Timer shooting_timer; // used to show the arm when Tux is shooting
Timer dying_timer;
Timer growing_timer;
+ Timer idle_timer;
Physic physic;
public: