pingus-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Pingus-CVS] CVS: Games/Pingus/src/actions bomber.cxx,1.26,1.27 faller.c


From: torangan
Subject: [Pingus-CVS] CVS: Games/Pingus/src/actions bomber.cxx,1.26,1.27 faller.cxx,1.34,1.35 faller.hxx,1.17,1.18 floater.cxx,1.21,1.22
Date: 12 Feb 2003 22:40:49 -0000

Update of /usr/local/cvsroot/Games/Pingus/src/actions
In directory dark:/tmp/cvs-serv7035/src/actions

Modified Files:
        bomber.cxx faller.cxx faller.hxx floater.cxx 
Log Message:
applied Gervases patch


Index: bomber.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/actions/bomber.cxx,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -d -r1.26 -r1.27
--- bomber.cxx  28 Dec 2002 16:10:17 -0000      1.26
+++ bomber.cxx  12 Feb 2003 22:40:47 -0000      1.27
@@ -29,6 +29,8 @@
 #include "../string_converter.hxx"
 #include "../world.hxx"
 #include "../particles/pingu_particle_holder.hxx"
+#include "../colliders/pingu_collider.hxx"
+#include "../movers/linear_mover.hxx"
 #include "bomber.hxx"
 
 namespace Actions {
@@ -79,25 +81,33 @@
 {
   sprite.update ();
 
-  // Do something according to the action that was in use before
-  switch (pingu->get_previous_action())
-    {
-    case Actions::Faller:
-      move_with_forces();
-      break;
-    case Actions::Floater:
-      if (rel_getpixel(0, -1) == Groundtype::GP_NOTHING)
-        pingu->set_y(pingu->get_y() + 0.5f);
-      break;
-    default:
-      break;
-    }
+  Movers::LinearMover mover(WorldObj::get_world(), pingu->get_pos());
+
+  Vector velocity = pingu->get_velocity();
+
+  // Move the Pingu with different colliders depending on whether the Pingu is
+  // moving down (i.e. can't go through Bridges) or moving up (i.e. can go
+  // through Bridges)
+  if (velocity.y > 0.0f)
+    mover.update(velocity, Colliders::PinguCollider(true, pingu_height));
+  else
+    mover.update(velocity, Colliders::PinguCollider(false, pingu_height));
+
+  pingu->set_pos(mover.get_pos());
 
   // If the Bomber hasn't 'exploded' yet and it has hit Water or Lava
   if (sprite.get_frame () <= 9 && (rel_getpixel(0, -1) == Groundtype::GP_WATER
       || rel_getpixel(0, -1) == Groundtype::GP_LAVA)) 
     {
       pingu->set_action(Actions::Drown);
+      return;
+    }
+
+  // If the Bomber hasn't 'exploded' yet and it has hit the ground too quickly
+  if (sprite.get_frame () <= 9 && rel_getpixel(0, -1) != Groundtype::GP_NOTHING
+      && velocity.y > 20.0f)
+    {
+      pingu->set_action(Actions::Splashed);
       return;
     }
 

Index: faller.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/actions/faller.cxx,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -d -r1.34 -r1.35
--- faller.cxx  3 Nov 2002 22:20:29 -0000       1.34
+++ faller.cxx  12 Feb 2003 22:40:47 -0000      1.35
@@ -28,8 +28,6 @@
 
 namespace Actions {
 
-const float Faller::deadly_velocity = 20.0f;
-
 Faller::Faller (Pingu* p)
   : PinguAction(p),
     faller(Sprite("Pingus/faller" + to_string(pingu->get_owner ()), "pingus")),

Index: faller.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/actions/faller.hxx,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- faller.hxx  3 Nov 2002 20:30:38 -0000       1.17
+++ faller.hxx  12 Feb 2003 22:40:47 -0000      1.18
@@ -34,8 +34,6 @@
   int falling;
 
 public:
-  static const float deadly_velocity;
-
   Faller(Pingu*);
   virtual ~Faller();
   

Index: floater.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/actions/floater.cxx,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -d -r1.21 -r1.22
--- floater.cxx 13 Oct 2002 20:25:00 -0000      1.21
+++ floater.cxx 12 Feb 2003 22:40:47 -0000      1.22
@@ -38,7 +38,7 @@
 {
   sprite.update ();
 
-  pingu->set_velocity(Vector(0.0, 0.0));
+  pingu->set_velocity(Vector(0.0f, 1.0f));
   
   if (rel_getpixel(0, -1) == Groundtype::GP_NOTHING) 
     {





reply via email to

[Prev in Thread] Current Thread [Next in Thread]