X-Git-Url: https://git.octo.it/?a=blobdiff_plain;ds=sidebyside;f=src%2Fworldmap%2Ftux.cpp;h=365b98537ce94ebb99edb5af4f49bee79dbce51f;hb=2740fa90c947ec4d1ff9c7d3eeb12cf31ce4d26e;hp=c76af1cd3554dcefd36de4f7de95689d9c4391d9;hpb=c161b88a74b82d755866b5a0294f1a3aaa41d55d;p=supertux.git diff --git a/src/worldmap/tux.cpp b/src/worldmap/tux.cpp index c76af1cd3..365b98537 100644 --- a/src/worldmap/tux.cpp +++ b/src/worldmap/tux.cpp @@ -34,7 +34,7 @@ static const float map_message_TIME = 2.8f; Tux::Tux(WorldMap* worldmap_) : back_direction(), worldmap(worldmap_), - sprite(), + sprite(SpriteManager::current()->create("images/worldmap/common/tux.sprite")), controller(), input_direction(), direction(), @@ -43,8 +43,6 @@ Tux::Tux(WorldMap* worldmap_) : moving(), ghost_mode() { - sprite = sprite_manager->create("images/worldmap/common/tux.sprite"); - offset = 0; moving = false; direction = D_NONE; @@ -70,6 +68,12 @@ Tux::draw(DrawingContext& context) case ICE_BONUS: sprite->set_action(moving ? "ice-walking" : "ice-stop"); break; + case AIR_BONUS: + sprite->set_action(moving ? "air-walking" : "air-stop"); + break; + case EARTH_BONUS: + sprite->set_action(moving ? "earth-walking" : "earth-stop"); + break; case NO_BONUS: sprite->set_action(moving ? "small-walking" : "small-stop"); break; @@ -291,14 +295,14 @@ Tux::tryContinueWalking(float elapsed_time) void Tux::updateInputDirection() { - Controller* controller = g_input_manager->get_controller(); - if(controller->hold(Controller::UP)) + Controller* controller_ = InputManager::current()->get_controller(); + if(controller_->hold(Controller::UP)) input_direction = D_NORTH; - else if(controller->hold(Controller::DOWN)) + else if(controller_->hold(Controller::DOWN)) input_direction = D_SOUTH; - else if(controller->hold(Controller::LEFT)) + else if(controller_->hold(Controller::LEFT)) input_direction = D_WEST; - else if(controller->hold(Controller::RIGHT)) + else if(controller_->hold(Controller::RIGHT)) input_direction = D_EAST; }