From: Wolfgang Becker Date: Sun, 16 Jul 2006 00:30:09 +0000 (+0000) Subject: Rock update X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=b499eed459260840b5940b11d150357d67095ccc;p=supertux.git Rock update SVN-Revision: 4028 --- diff --git a/data/images/objects/rock/rock.png b/data/images/objects/rock/rock.png new file mode 100644 index 000000000..40f5432e3 Binary files /dev/null and b/data/images/objects/rock/rock.png differ diff --git a/data/images/objects/rock/rock.sprite b/data/images/objects/rock/rock.sprite index 66683d641..082868456 100644 --- a/data/images/objects/rock/rock.sprite +++ b/data/images/objects/rock/rock.sprite @@ -1,5 +1,5 @@ (supertux-sprite (action (name "normal") - (images "../../tiles/blocks/block11.png")) + (images "rock.png")) ) diff --git a/src/object/rock.cpp b/src/object/rock.cpp index 467377ce5..1eb8f6d31 100644 --- a/src/object/rock.cpp +++ b/src/object/rock.cpp @@ -21,13 +21,17 @@ #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; } }