From: Ingo Ruhnke Date: Thu, 22 Apr 2004 00:13:33 +0000 (+0000) Subject: - added small skid tux X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=03c6b33325cae12a5e2a017513aca3af62bf9b2d;p=supertux.git - added small skid tux SVN-Revision: 622 --- diff --git a/data/supertux.strf b/data/supertux.strf index 59605f0e6..27a52da01 100644 --- a/data/supertux.strf +++ b/data/supertux.strf @@ -218,6 +218,20 @@ "shared/iceflower-3.png" "shared/iceflower-2.png" "shared/iceflower-1.png")) + + (sprite (name "smalltux-gameover") + (images "shared/smalltux-gameover-0.png" + "shared/smalltux-gameover-1.png")) + + (sprite (name "smalltux-skid-left") + (x-hotspot 6) + (y-hotspot 8) + (images "shared/smalltux-skid-left.png")) + + (sprite (name "smalltux-skid-right") + (x-hotspot 6) + (y-hotspot 8) + (images "shared/smalltux-skid-right.png")) ) ;; EOF ;; diff --git a/src/player.cpp b/src/player.cpp index 6b4db8269..add5d5100 100644 --- a/src/player.cpp +++ b/src/player.cpp @@ -35,6 +35,9 @@ Surface* smalltux_jump_left; Surface* smalltux_jump_right; Surface* smalltux_stand_left; Surface* smalltux_stand_right; +Sprite* smalltux_gameover; +Sprite* smalltux_skid_left; +Sprite* smalltux_skid_right; Sprite* bigtux_right; Sprite* bigtux_left; @@ -525,30 +528,40 @@ Player::draw() if (!got_coffee) { - if (physic.get_velocity_y() != 0) + if (!skidding_timer.started()) { - if (dir == RIGHT) - smalltux_jump_right->draw( base.x - scroll_x, base.y - 10); - else - smalltux_jump_left->draw( base.x - scroll_x, base.y - 10); - } - else - { - if (fabsf(physic.get_velocity_x()) < 1.0f) // standing + if (physic.get_velocity_y() != 0) { if (dir == RIGHT) - smalltux_stand_right->draw( base.x - scroll_x, base.y - 9); + smalltux_jump_right->draw( base.x - scroll_x, base.y - 10); else - smalltux_stand_left->draw( base.x - scroll_x, base.y - 9); + smalltux_jump_left->draw( base.x - scroll_x, base.y - 10); } - else // moving + else { - if (dir == RIGHT) - tux_right[(global_frame_counter/2) % tux_right.size()]->draw(base.x - scroll_x, base.y - 9); - else - tux_left[(global_frame_counter/2) % tux_left.size()]->draw(base.x - scroll_x, base.y - 9); + if (fabsf(physic.get_velocity_x()) < 1.0f) // standing + { + if (dir == RIGHT) + smalltux_stand_right->draw( base.x - scroll_x, base.y - 9); + else + smalltux_stand_left->draw( base.x - scroll_x, base.y - 9); + } + else // moving + { + if (dir == RIGHT) + tux_right[(global_frame_counter/2) % tux_right.size()]->draw(base.x - scroll_x, base.y - 9); + else + tux_left[(global_frame_counter/2) % tux_left.size()]->draw(base.x - scroll_x, base.y - 9); + } } } + else + { + if (dir == RIGHT) + smalltux_skid_right->draw(base.x - scroll_x, base.y); + else + smalltux_skid_left->draw(base.x - scroll_x, base.y); + } } else { @@ -564,7 +577,7 @@ Player::draw() } } } - else + else // Large Tux { if (invincible_timer.started()) { diff --git a/src/player.h b/src/player.h index b0edbd23c..6a49a7779 100644 --- a/src/player.h +++ b/src/player.h @@ -81,6 +81,9 @@ extern Surface* smalltux_jump_left; extern Surface* smalltux_jump_right; extern Surface* smalltux_stand_left; extern Surface* smalltux_stand_right; +extern Sprite* smalltux_skid_left; +extern Sprite* smalltux_skid_right; +extern Sprite* smalltux_gameover; extern Sprite* bigtux_right; extern Sprite* bigtux_left; extern Sprite* bigtux_right_jump; diff --git a/src/resources.cpp b/src/resources.cpp index 62429531b..fadd88c80 100644 --- a/src/resources.cpp +++ b/src/resources.cpp @@ -47,6 +47,11 @@ void loadshared() sprite_manager = new SpriteManager(datadir + "/supertux.strf"); /* Tuxes: */ + smalltux_gameover = sprite_manager->load("smalltux-gameover"); + + smalltux_skid_left = sprite_manager->load("smalltux-skid-left"); + smalltux_skid_right = sprite_manager->load("smalltux-skid-right"); + smalltux_stand_left = new Surface(datadir + "/images/shared/smalltux-left-6.png", USE_ALPHA); smalltux_stand_right = new Surface(datadir + "/images/shared/smalltux-right-6.png", USE_ALPHA); @@ -296,6 +301,8 @@ void unloadshared(void) free_special_gfx(); + delete smalltux_gameover; + for (i = 0; i < 3; i++) { delete tux_right[i]; diff --git a/src/title.cpp b/src/title.cpp index b856cea76..33a28e24f 100644 --- a/src/title.cpp +++ b/src/title.cpp @@ -358,8 +358,7 @@ void title(void) frame++; SDL_Delay(25); - if(!playing_music) - play_music(music); + play_music(music); } /* Free surfaces: */