Esempio n. 1
0
 public override bool collides(Collideable other)
 {
     int curX = (int)pos.X;
     int curY = (int)pos.Y;
     Rectangle tempRec = picRect;
     Vector2 tempPos = pos;
     bool collide = false;
     for (int i = 0; i < height; i++)
     {
         for (int j = 0; j < width; j++)
         {
             picRect = new Rectangle(curX, curY, pic.Width, pic.Height);
             pos = new Vector2((float)curX,(float)curY);
             collide = base.collides(other);
             if (collide)
             {
                 picRect = tempRec;
                 pos = tempPos;
                 return true;
             }
             curX += pic.Width;
         }
         curX = (int)pos.X;
         curY += pic.Height;
     }
     picRect = tempRec;
     pos = tempPos;
     return collide;
 }
Esempio n. 2
0
 public Point getQuad(Collideable o)
 {
     Point pos = new Point(o.getRectangle().X, o.getRectangle().Y);
     int numQuads = 100;
     return new Point(pos.X/100, pos.Y/100);
 }
Esempio n. 3
0
 public abstract void collidedWith(Collideable other);
Esempio n. 4
0
 public abstract bool collides(Collideable other);
Esempio n. 5
0
 public override void collidedWith(Collideable other)
 {
     canMoveUp = false; canMoveDown = false; canMoveLeft = false; canMoveRight = false;
     //setVelocity(new Vector2(0, 0));
 }
Esempio n. 6
0
 public override void collidedWith(Collideable other)
 {
     game.remove(other);
     game.remove(this);
 }
Esempio n. 7
0
 public bool remove(Collideable other)
 {
     if (other is Being)
     {
         return beings.Remove((Being)other);
     }
     else if(other is Projectile)
     {
         return projectiles.Remove((Projectile)other);
     }
     else if (other is Obstacle)
     {
         return map.remove((Obstacle)other);
     }
     return false;
 }