X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Fplayer.cpp;h=cf945e4fc87cd5783d56908a756d3d86bad3be05;hb=f41a5719a2dc1a50674c69fa511c38a152cc4b03;hp=e50bdab2fc3b8ef71a019ffeda84f3f37f7ceac2;hpb=e4d4375bf4b6802321d956f5f3886320b7275cf0;p=supertux.git diff --git a/src/player.cpp b/src/player.cpp index e50bdab2f..cf945e4fc 100644 --- a/src/player.cpp +++ b/src/player.cpp @@ -91,29 +91,16 @@ void player_input_init(player_input_type* pplayer_input) } void -TuxBodyParts::set_action(std::string action) +TuxBodyParts::set_action(std::string action, int loops) { if(head != NULL) - head->set_action(action); + head->set_action(action, loops); if(body != NULL) - body->set_action(action); + body->set_action(action, loops); if(arms != NULL) - arms->set_action(action); + arms->set_action(action, loops); if(feet != NULL) - feet->set_action(action); -} - -void -TuxBodyParts::one_time_animation() -{ - if(head != NULL) - head->start_animation(1); - if(body != NULL) - body->start_animation(1); - if(arms != NULL) - arms->start_animation(1); - if(feet != NULL) - feet->start_animation(1); + feet->set_action(action, loops); } void @@ -789,11 +776,9 @@ Player::draw(DrawingContext& context) if(size == BIG) { if(dir == LEFT) - tux_body->head->set_action("idle-left"); + tux_body->head->set_action("idle-left", 1); else // dir == RIGHT - tux_body->head->set_action("idle-right"); - - tux_body->head->start_animation(1); + tux_body->head->set_action("idle-right", 1); } } @@ -885,8 +870,7 @@ Player::collision(GameObject& other, const CollisionHit& hit) physic.set_velocity_y(.1); } - if(fabsf(hit.normal.x) > .5) { // hit on the side? - printf("s"); fflush(stdout); + if(fabsf(hit.normal.x) > .9) { // hit on the side? physic.set_velocity_x(0); } @@ -948,6 +932,7 @@ Player::kill(HurtMode mode) --player_status.lives; dying = DYING_SQUISHED; dying_timer.start(3.0); + flags |= FLAG_NO_COLLDET; } }