[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Pingus-CVS] r3373 - trunk/pingus/src/actions
From: |
grumbel at BerliOS |
Subject: |
[Pingus-CVS] r3373 - trunk/pingus/src/actions |
Date: |
Mon, 29 Oct 2007 04:09:12 +0100 |
Author: grumbel
Date: 2007-10-29 04:09:12 +0100 (Mon, 29 Oct 2007)
New Revision: 3373
Modified:
trunk/pingus/src/actions/faller.cpp
Log:
- fixed faller/jumper bug, needs testing
Modified: trunk/pingus/src/actions/faller.cpp
===================================================================
--- trunk/pingus/src/actions/faller.cpp 2007-10-29 03:08:38 UTC (rev 3372)
+++ trunk/pingus/src/actions/faller.cpp 2007-10-29 03:09:12 UTC (rev 3373)
@@ -56,18 +56,6 @@
tumbler[pingu->direction].update();
faller[pingu->direction].update();
- // Pingu stands on ground
- if (rel_getpixel(0, -1) != Groundtype::GP_NOTHING)
- {
- // FIXME: Why handle this here and not in the mover loop below?
- std::cout << "Pingus landed: " << pingu->get_velocity().y << " deadly: "
<< deadly_velocity << std::endl;
- if (pingu->get_velocity().y > deadly_velocity)
- pingu->set_action(Actions::Splashed);
- else
- pingu->set_action(Actions::Walker);
- return;
- }
-
// FIXME: This should be triggered at a later point, when close to
// FIXME: deadly_velocity or something like that. A translation
// FIXME: animation for the floater might also help
@@ -98,10 +86,27 @@
{
move = mover.remaining();
- // If the Pingu collided into something while moving down...
- if (velocity.y > 0.0f
- && rel_getpixel(0, -2) != Groundtype::GP_NOTHING)
+ if (rel_getpixel(0, -1) == Groundtype::GP_NOTHING &&
+ rel_getpixel(0, -2) == Groundtype::GP_NOTHING &&
+ rel_getpixel(0, -3) == Groundtype::GP_NOTHING)
{
+ // Make Pingu bounce off wall
+ move.x = -(move.x / 3.0f);
+ velocity.x = -(velocity.x / 3.0f);
+
+ // Make the Pingu face the correct direction. NB: Pingu may
+ // previously have been facing in the opposite direction of its
+ // velocity because of an explosion.
+ if (velocity.x > 0.0f)
+ pingu->direction.right();
+ else
+ pingu->direction.left();
+
+ pingu->set_velocity(velocity);
+ break;
+ }
+ else if (velocity.y > 0.0f) // If the Pingu collided into something
while moving down...
+ {
// Ping is on ground/water/something
if (rel_getpixel(0, -1) == Groundtype::GP_WATER
|| rel_getpixel(0, -1) == Groundtype::GP_LAVA)
@@ -111,47 +116,26 @@
// Did we stop too fast?
else if (fabs(pingu->get_velocity().y) > deadly_velocity)
{
- std::cout << "Pingus splashed: " << pingu->get_velocity().y
<< " " << deadly_velocity << std::endl;
+ //std::cout << "Pingus splashed: " <<
pingu->get_velocity().y << " " << deadly_velocity << std::endl;
pingu->set_action(Actions::Splashed);
}
- else if (fabs(pingu->get_velocity().x) > deadly_velocity)
- {
- pout(PINGUS_DEBUG_ACTIONS) << "Pingu: x Smashed on ground,
jumping" << std::endl;
- std::cout << "Pingus X Smash, what to do?: " <<
pingu->get_velocity().x << " " << deadly_velocity << std::endl;
- }
else
{
- // ???
+ // This is where the jumper bug happens
+ //std::cout << "Reached the unreachable: " <<
pingu->get_velocity().y << std::endl;
+ pingu->set_action(Actions::Walker);
}
break;
}
// If the Pingu collided into something while moving up...
// NB: +1 because Mover backs out of something it has collided with.
- else if (velocity.y < 0.0f
- && rel_getpixel(0, pingu_height + 1) !=
Groundtype::GP_NOTHING)
+ else // if (velocity.y < 0.0f)
{
// Don't make the Pingu go up any further.
move.y = 0.0f;
velocity.y = 0.0f;
}
- else
- {
- // Make Pingu bounce off wall
- move.x = -(move.x / 3.0f);
- velocity.x = -(velocity.x / 3.0f);
-
- // Make the Pingu face the correct direction. NB: Pingu may
- // previously have been facing in the opposite direction of its
- // velocity because of an explosion.
- if (velocity.x > 0.0f)
- pingu->direction.right();
- else
- pingu->direction.left();
-
- pingu->set_velocity(velocity);
- break;
- }
}
// Update the Pingu's velocity
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Pingus-CVS] r3373 - trunk/pingus/src/actions,
grumbel at BerliOS <=