X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Fplayer.cpp;h=86bb7d2e0bf9cd2178549a82fa83957766be0520;hb=5023c5b34da1b979a9bd829824662960bd3a7ff9;hp=b7633fe2b89f11944ace99756f3c9393e37e9fbf;hpb=0afed01400e59d9cb2e081b3f4ae78f97acf91ad;p=supertux.git diff --git a/src/player.cpp b/src/player.cpp index b7633fe2b..86bb7d2e0 100644 --- a/src/player.cpp +++ b/src/player.cpp @@ -748,24 +748,55 @@ Player::draw(DrawingContext& context) /* Set Tux sprite action */ if (duck && size != SMALL) - tux_body->set_action("duck"); + { + if(dir == LEFT) + tux_body->set_action("duck-left"); + else // dir == RIGHT + tux_body->set_action("duck-right"); + } else if (skidding_timer.started()) - tux_body->set_action("skid"); + { + if(dir == LEFT) + tux_body->set_action("skid-left"); + else // dir == RIGHT + tux_body->set_action("skid-right"); + } else if (kick_timer.started()) - tux_body->set_action("kick"); + { + if(dir == LEFT) + tux_body->set_action("kick-left"); + else // dir == RIGHT + tux_body->set_action("kick-right"); + } else if (butt_jump) - tux_body->set_action("buttjump"); + { + if(dir == LEFT) + tux_body->set_action("buttjump-left"); + else // dir == RIGHT + tux_body->set_action("buttjump-right"); + } else if (physic.get_velocity_y() != 0) - tux_body->set_action("jump"); + { + if(dir == LEFT) + tux_body->set_action("jump-left"); + else // dir == RIGHT + tux_body->set_action("jump-right"); + } else { if (fabsf(physic.get_velocity_x()) < 1.0f) // standing { - tux_body->set_action("stand"); + if(dir == LEFT) + tux_body->set_action("stand-left"); + else // dir == RIGHT + tux_body->set_action("stand-right"); } else // moving { - tux_body->set_action("walk"); + if(dir == LEFT) + tux_body->set_action("walk-left"); + else // dir == RIGHT + tux_body->set_action("walk-right"); } } @@ -773,7 +804,11 @@ Player::draw(DrawingContext& context) { if(size == BIG) { - tux_body->head->set_action("idle"); + if(dir == LEFT) + tux_body->head->set_action("idle-left"); + else // dir == RIGHT + tux_body->set_action("idle-right"); + tux_body->head->start_animation(1); } @@ -785,9 +820,19 @@ Player::draw(DrawingContext& context) shooting_timer.check()) { if (duck) - tux_body->arms->set_action("duck+grab"); + { + if(dir == LEFT) + tux_body->arms->set_action("duck+grab"); + else // dir == RIGHT + tux_body->set_action("duck-right"); + } else - tux_body->arms->set_action("grab"); + { + if(dir == LEFT) + tux_body->arms->set_action("grab"); + else // dir == RIGHT + tux_body->set_action("duck-right"); + } } /* Draw Tux */