/[enigma]/enigma/src/actors.cc
ViewVC logotype

Diff of /enigma/src/actors.cc

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.15 by reallysoft, Mon May 12 20:41:52 2003 UTC revision 1.16 by dheck, Tue May 13 18:45:51 2003 UTC
# Line 272  namespace Line 272  namespace
272  }  }
273    
274  BasicBall::BasicBall(const char *kind, double radius, double mass)  BasicBall::BasicBall(const char *kind, double radius, double mass)
275  : Actor(kind, V2()), state(NO_STATE)  : Actor(kind, V2()), state(NO_STATE),
276      sinkDepth (0)
277  {  {
278      world::ActorInfo *ai = get_actorinfo();      world::ActorInfo *ai = get_actorinfo();
279      ai->radius = radius;      ai->radius = radius;
# Line 310  void BasicBall::think(double dtime) { Line 311  void BasicBall::think(double dtime) {
311          ActorInfo *ai = get_actorinfo();          ActorInfo *ai = get_actorinfo();
312    
313          const double defaultSinkSpeed = 10.0; // 10.0 means : sink in 1 second (if absVelocity == 0)          const double defaultSinkSpeed = 10.0; // 10.0 means : sink in 1 second (if absVelocity == 0)
314          const double nonSinkVelocity  = 8.0; // at this velocity don't sink; above: raise          const double nonSinkVelocity  = 6.0; // at this velocity don't sink; above: raise
315    
316          double absVelocity = sqrt(ai->vel[0]*ai->vel[0] + ai->vel[1]*ai->vel[1]);          double absVelocity = length(ai->vel);
317          double sinkSpeed    = absVelocity * -(defaultSinkSpeed/nonSinkVelocity) + defaultSinkSpeed;          double sinkSpeed    = absVelocity * -(defaultSinkSpeed/nonSinkVelocity) + defaultSinkSpeed;
318    
319          sinkDepth += sinkSpeed*dtime;          sinkDepth += sinkSpeed*dtime;

Legend:
Removed from v.1.15  
changed lines
  Added in v.1.16

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26