projects
/
supertux.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
new oldschool growup sound
[supertux.git]
/
src
/
object
/
growup.cpp
diff --git
a/src/object/growup.cpp
b/src/object/growup.cpp
index
6af5b5b
..
1031a83
100644
(file)
--- a/
src/object/growup.cpp
+++ b/
src/object/growup.cpp
@@
-32,7
+32,7
@@
GrowUp::GrowUp(Direction direction)
{
physic.enable_gravity(true);
physic.set_velocity_x((direction == LEFT)?-100:100);
{
physic.enable_gravity(true);
physic.set_velocity_x((direction == LEFT)?-100:100);
- sound_manager->preload("sounds/grow.
wav
");
+ sound_manager->preload("sounds/grow.
ogg
");
}
void
}
void
@@
-44,26
+44,36
@@
GrowUp::update(float elapsed_time)
void
GrowUp::collision_solid(const CollisionHit& hit)
{
void
GrowUp::collision_solid(const CollisionHit& hit)
{
- if(hit.top || hit.bottom)
+ if(hit.top)
+ physic.set_velocity_y(0);
+ if(hit.bottom && physic.get_velocity_y() > 0)
physic.set_velocity_y(0);
if(hit.left || hit.right)
physic.set_velocity_x(-physic.get_velocity_x());
}
HitResponse
physic.set_velocity_y(0);
if(hit.left || hit.right)
physic.set_velocity_x(-physic.get_velocity_x());
}
HitResponse
-GrowUp::collision(GameObject& other, const CollisionHit& )
+GrowUp::collision(GameObject& other, const CollisionHit&
hit
)
{
Player* player = dynamic_cast<Player*>(&other);
if(player != 0) {
{
Player* player = dynamic_cast<Player*>(&other);
if(player != 0) {
- if(!player->add_bonus(GROWUP_BONUS, true))
- return FORCE_MOVE;
+ if(!player->add_bonus(GROWUP_BONUS, true)){
+ // Tux can't grow right now.
+ collision_solid( hit );
+ return ABORT_MOVE;
+ }
- sound_manager->play("sounds/grow.
wav
");
+ sound_manager->play("sounds/grow.
ogg
");
remove_me();
remove_me();
-
+
return ABORT_MOVE;
}
return FORCE_MOVE;
}
return ABORT_MOVE;
}
return FORCE_MOVE;
}
+void
+GrowUp::do_jump()
+{
+ physic.set_velocity_y(-300);
+}