- added small skid tux
authorIngo Ruhnke <grumbel@gmx.de>
Thu, 22 Apr 2004 00:13:33 +0000 (00:13 +0000)
committerIngo Ruhnke <grumbel@gmx.de>
Thu, 22 Apr 2004 00:13:33 +0000 (00:13 +0000)
SVN-Revision: 622

data/supertux.strf
src/player.cpp
src/player.h
src/resources.cpp
src/title.cpp

index 59605f0..27a52da 100644 (file)
           "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 ;;
index 6b4db82..add5d51 100644 (file)
@@ -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())
             {
index b0edbd2..6a49a77 100644 (file)
@@ -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;
index 6242953..fadd88c 100644 (file)
@@ -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];
index b856cea..33a28e2 100644 (file)
@@ -358,8 +358,7 @@ void title(void)
       frame++;
       SDL_Delay(25);
 
-      if(!playing_music)
-       play_music(music);
+      play_music(music);
     }
   /* Free surfaces: */