public PacemakerComponent(Game game, Rectangle bounds)
     : base(game)
 {
     this.game = game;
     boundingRec = bounds;
     p = new PhysicsComponent(game, bounds);
 }
Example #2
0
 /**
  * Returns true if the PhysicsComponents are the same
  **/
 public bool checkColliding(PhysicsComponent p)
 {
     if (p.id != id)
     {
         return bounds.Intersects(p.bounds);
     }
     return false;
 }
Example #3
0
 public void moveRight(List<PhysicsComponent> p)
 {
     int velocity = (int)Math.Round((decimal)(3*(game.Heart.BodyPressure/100)));
     bool collision = false;
     PhysicsComponent core = new PhysicsComponent(base.p);
     core.Update(base.boundingRec.X + velocity, base.boundingRec.Y);
     foreach (PhysicsComponent f in p)
     {
         collision = core.checkColliding(f);
         if (collision)
                 return;
     }
     Position.X = Position.X + velocity;
     UpdateCollision(new Rectangle(base.boundingRec.X + velocity, base.boundingRec.Y, base.boundingRec.Width, base.boundingRec.Height));
 }
Example #4
0
 /**
  * Just copies a class
  **/
 public PhysicsComponent(PhysicsComponent rec)
     : this(rec.game, rec.bounds)
 {
     this.id = rec.id;
     totalID--;
 }