Rock update
authorWolfgang Becker <uafr@gmx.de>
Sun, 16 Jul 2006 00:30:09 +0000 (00:30 +0000)
committerWolfgang Becker <uafr@gmx.de>
Sun, 16 Jul 2006 00:30:09 +0000 (00:30 +0000)
SVN-Revision: 4028

data/images/objects/rock/rock.png [new file with mode: 0644]
data/images/objects/rock/rock.sprite
src/object/rock.cpp

diff --git a/data/images/objects/rock/rock.png b/data/images/objects/rock/rock.png
new file mode 100644 (file)
index 0000000..40f5432
Binary files /dev/null and b/data/images/objects/rock/rock.png differ
index 66683d6..0828684 100644 (file)
@@ -1,5 +1,5 @@
 (supertux-sprite
       (action
         (name "normal")
-        (images "../../tiles/blocks/block11.png"))
+        (images "rock.png"))
 )
index 467377c..1eb8f6d 100644 (file)
 
 #include "rock.hpp"
 #include "lisp/writer.hpp"
-#include "video/drawing_context.hpp"
-#include "resources.hpp"
 #include "object_factory.hpp"
+#include "audio/sound_manager.hpp"
+
+namespace {
+  const std::string ROCK_SOUND = "sounds/brick.wav"; //TODO use own sound.
+}
 
 Rock::Rock(const lisp::Lisp& reader)
        : MovingSprite(reader, "images/objects/rock/rock.sprite")
 {
+  sound_manager->preload( ROCK_SOUND );
   on_ground = false;
   flags |= FLAG_SOLID | FLAG_PORTABLE;
 }
@@ -55,7 +59,8 @@ void
 Rock::collision_solid(const CollisionHit& hit)
 {
   physic.set_velocity(0, 0);
-  if( hit.bottom ){
+  if( hit.bottom  && !on_ground ){
+    sound_manager->play( ROCK_SOUND, get_pos() );
      on_ground = true;
   }
 }