From: Ondřej Hošek Date: Thu, 3 Nov 2005 10:36:01 +0000 (+0000) Subject: * Fixed the Yeti's sprite choosing per Groundwater's request. X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=5bdda9f457554e43dedd490a75dc2527b9f8e851;p=supertux.git * Fixed the Yeti's sprite choosing per Groundwater's request. * Added a "flip" cheat to flip the level vertically. * Added the --disable-sfx and --disable-music commandline args. SVN-Revision: 2937 --- diff --git a/data/images/creatures/yeti/yeti.sprite b/data/images/creatures/yeti/yeti.sprite index 576fbd2e7..fe77eaf4d 100644 --- a/data/images/creatures/yeti/yeti.sprite +++ b/data/images/creatures/yeti/yeti.sprite @@ -1,10 +1,10 @@ (supertux-sprite (action (name "right") - (images "iceyeti_0.png" + (images "iceyeti_0.png" "iceyeti_1.png" "iceyeti_2.png" - "iceyeti_1.png") + "iceyeti_1.png") ) (action (name "left") @@ -18,5 +18,12 @@ (name "jump-left") (mirror-action "jump-right") ) + (action + (name "stand-right") + (images "iceyeti_1.png") + ) + (action + (name "stand-left") + (mirror-action "stand-right") + ) ) - diff --git a/src/badguy/yeti.cpp b/src/badguy/yeti.cpp index 7ca7c6be6..10a33e076 100644 --- a/src/badguy/yeti.cpp +++ b/src/badguy/yeti.cpp @@ -91,6 +91,10 @@ Yeti::active_update(float elapsed_time) // jump sound_manager->play("sounds/yeti_gna.wav"); physic.set_velocity_y(JUMP_VEL1); + if (side == LEFT) // on the left, facing Tux who is on the right + sprite->set_action("jump-right"); + else + sprite->set_action("jump-left"); } break; default: @@ -104,6 +108,7 @@ void Yeti::go_right() { // jump and move right + sprite->set_action("right"); physic.set_velocity_y(JUMP_VEL1); physic.set_velocity_x(RUN_SPEED); state = GO_RIGHT; @@ -113,6 +118,7 @@ Yeti::go_right() void Yeti::go_left() { + sprite->set_action("left"); physic.set_velocity_y(JUMP_VEL1); physic.set_velocity_x(-RUN_SPEED); state = GO_LEFT; @@ -214,18 +220,20 @@ Yeti::collision_solid(GameObject& , const CollisionHit& hit) } else if(state == GO_LEFT && !timer.started()) { side = LEFT; summon_snowball(); - sprite->set_action("right"); + sprite->set_action("stand-right"); angry_jumping(); } else if(state == GO_RIGHT && !timer.started()) { side = RIGHT; summon_snowball(); - sprite->set_action("left"); + sprite->set_action("stand-left"); angry_jumping(); } else if(state == ANGRY_JUMPING) { if(!timer.started()) { // we just landed - // FixME need help here setting the walk,stand,jump image states - sprite->set_action("jump-right"); + if (side == LEFT) // standing on the left, facing Tux who is on the right + sprite->set_action("stand-right"); + else + sprite->set_action("stand-left"); jumpcount++; // make a stalactite falling down and shake camera a bit Sector::current()->camera->shake(.1, 0, 10); diff --git a/src/game_session.cpp b/src/game_session.cpp index 65ce7c479..5bca083cf 100644 --- a/src/game_session.cpp +++ b/src/game_session.cpp @@ -64,6 +64,7 @@ #include "gameconfig.hpp" #include "gettext.hpp" #include "exceptions.hpp" +#include "flip_level_transformer.hpp" // the engine will be run with a logical framerate of 64fps. // We chose 64fps here because it is a power of 2, so 1/64 gives an "even" @@ -368,6 +369,10 @@ GameSession::try_cheats() currentsector->camera->reset( Vector(tux.get_pos().x, tux.get_pos().y)); } + if(main_controller->check_cheatcode("flip")) { + FlipLevelTransformer flip_transformer; + flip_transformer.transform(GameSession::current()->get_current_level()); + } if(main_controller->check_cheatcode("finish")) { // finish current sector exit_status = ES_LEVEL_FINISHED; diff --git a/src/main.cpp b/src/main.cpp index f89805ddc..22073bbb5 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -187,6 +187,8 @@ static void print_usage(const char* argv0) " -f, --fullscreen Run in fullscreen mode\n" " -w, --window Run in window mode\n" " -g, --geometry WIDTHxHEIGHT Run SuperTux in given resolution\n" + " --disable-sfx Disable sound effects\n" + " --disable-music Disable music\n" " --help Show this help message\n" " --version Display SuperTux version and quit\n" " --show-fps Display framerate in levels\n" @@ -216,6 +218,10 @@ static void parse_commandline(int argc, char** argv) } } else if(arg == "--show-fps") { config->show_fps = true; + } else if(arg == "--disable-sfx") { + config->sound_enabled = false; + } else if(arg == "--disable-music") { + config->music_enabled = false; } else if(arg == "--play-demo") { if(i+1 >= argc) { print_usage(argv[0]);