projects
/
supertux.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Tux grows faster, stops growing when hit
[supertux.git]
/
src
/
object
/
rock.cpp
diff --git
a/src/object/rock.cpp
b/src/object/rock.cpp
index
e1421f2
..
7c56e1a
100644
(file)
--- a/
src/object/rock.cpp
+++ b/
src/object/rock.cpp
@@
-29,6
+29,15
@@
namespace {
const std::string ROCK_SOUND = "sounds/brick.wav"; //TODO use own sound.
}
const std::string ROCK_SOUND = "sounds/brick.wav"; //TODO use own sound.
}
+Rock::Rock(const Vector& pos, std::string spritename)
+ : MovingSprite(pos, spritename)
+{
+ sound_manager->preload(ROCK_SOUND);
+ on_ground = false;
+ grabbed = false;
+ set_group(COLGROUP_MOVING_STATIC);
+}
+
Rock::Rock(const lisp::Lisp& reader)
: MovingSprite(reader, "images/objects/rock/rock.sprite")
{
Rock::Rock(const lisp::Lisp& reader)
: MovingSprite(reader, "images/objects/rock/rock.sprite")
{
@@
-82,7
+91,7
@@
Rock::collision_solid(const CollisionHit& hit)
if(hit.crush)
physic.set_velocity(0, 0);
if(hit.crush)
physic.set_velocity(0, 0);
- if(hit.bottom && !on_ground) {
+ if(hit.bottom && !on_ground
&& !grabbed
) {
sound_manager->play(ROCK_SOUND, get_pos());
on_ground = true;
}
sound_manager->play(ROCK_SOUND, get_pos());
on_ground = true;
}
@@
-114,7
+123,7
@@
Rock::grab(MovingObject& , const Vector& pos, Direction)
movement = pos - get_pos();
last_movement = movement;
set_group(COLGROUP_TOUCHABLE);
movement = pos - get_pos();
last_movement = movement;
set_group(COLGROUP_TOUCHABLE);
- on_ground =
tru
e;
+ on_ground =
fals
e;
grabbed = true;
}
grabbed = true;
}