[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Pingus-CVS] CVS: Games/Pingus/src/actions faller.cxx,1.5,1.6 jumper.cxx
From: |
grumbel |
Subject: |
[Pingus-CVS] CVS: Games/Pingus/src/actions faller.cxx,1.5,1.6 jumper.cxx,1.1,1.2 |
Date: |
25 Jun 2002 14:54:03 -0000 |
Update of /usr/local/cvsroot/Games/Pingus/src/actions
In directory dark:/tmp/cvs-serv27877/actions
Modified Files:
faller.cxx jumper.cxx
Log Message:
- editor remembers now filenames from the command line
- jumper/faller now 'bounces' from walls and is less stucky, the
test/jumper.xml shows a situation in which it can still get stuck
Index: faller.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/actions/faller.cxx,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- faller.cxx 24 Jun 2002 14:25:03 -0000 1.5
+++ faller.cxx 25 Jun 2002 14:54:01 -0000 1.6
@@ -54,23 +54,35 @@
tumbler.update (delta);
faller.update (delta);
- for (unsigned int i=0; i < pingu->persist.size(); ++i) {
- if (pingu->persist[i]->get_name() == "Floater") {
- pingu->set_paction("floater");
- return;
- }
- }
-
+ // FIXME: This should be triggered at a later point, when close to
+ // FIXME: deadly_velocity or something like that
+ for (unsigned int i=0; i < pingu->persist.size(); ++i) {
+ if (pingu->persist[i]->get_name() == "Floater") {
+ pingu->set_paction("floater");
+ return;
+ }
+ }
+
+ // Pingu stands on ground
+ if (rel_getpixel(0, -1) != ColMap::NOTHING)
+ {
+ pingu->set_paction ("walker");
+ return;
+ }
+
// Apply all forces
pingu->velocity = ForcesHolder::apply_forces(pingu->pos, pingu->velocity);
CL_Vector newp = pingu->velocity;
-
+ CL_Vector last_pos;
+
// Update x and y by moving the penguin to it's target *slowly*
// and checking if the penguin has hit the bottom at each loop
- while(rel_getpixel(0, -1) == ColMap::NOTHING
+ while(rel_getpixel(0, 0) == ColMap::NOTHING
&& (fabs(newp.x) >= 1 || fabs(newp.y) >= 1))
{
+ last_pos = pingu->pos;
+
if (fabs(newp.x) >= 1)
{
// Since the velocity might be a
@@ -103,16 +115,16 @@
}
// Now that the Pingu is moved, check if he hits the ground.
- if (rel_getpixel(0, -1) == ColMap::NOTHING)
+ if (rel_getpixel(0, 0) == ColMap::NOTHING)
{ // if pingu is not on ground
++falling;
if (falling > 3)
pingu->environment = ENV_AIR;
}
- else // Ping is on ground
+ else // Ping is on ground/water/something
{
- if (rel_getpixel(0, -1) & ColMap::WATER)
+ if (rel_getpixel(0, 0) & ColMap::WATER)
{
pingu->set_paction("drown");
return;
@@ -131,10 +143,13 @@
}
}
// Reset the velocity
- pingu->velocity.x = 0;
+ pingu->velocity.x = -(pingu->velocity.x/3);
pingu->velocity.y = 0;
+
+ pingu->pos = last_pos;
+
// FIXME: UGLY!
- pingu->set_action ("walker");
+ //pingu->set_action ("walker");
}
}
Index: jumper.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/actions/jumper.cxx,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- jumper.cxx 12 Jun 2002 19:01:42 -0000 1.1
+++ jumper.cxx 25 Jun 2002 14:54:01 -0000 1.2
@@ -50,9 +50,10 @@
pingu->velocity += CL_Vector(-10.0, -10.0);
}
+ // Move the pingu in the air, so that it can start 'falling'
pingu->pos.y -= 1;
- is_finished = true;
+ pingu->set_paction ("faller");
}
/* EOF */
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Pingus-CVS] CVS: Games/Pingus/src/actions faller.cxx,1.5,1.6 jumper.cxx,1.1,1.2,
grumbel <=
- Prev by Date:
[Pingus-CVS] CVS: Games/Pingus/src/editor editor.cxx,1.5,1.6 editor_event.cxx,1.8,1.9
- Next by Date:
[Pingus-CVS] CVS: Games/Pingus/data/levels/test jumper.xml,NONE,1.1
- Previous by thread:
[Pingus-CVS] CVS: Games/Pingus/src/editor editor.cxx,1.5,1.6 editor_event.cxx,1.8,1.9
- Next by thread:
[Pingus-CVS] CVS: Games/Pingus/data/levels/test jumper.xml,NONE,1.1
- Index(es):