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; }
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); }
public abstract void collidedWith(Collideable other);
public abstract bool collides(Collideable other);
public override void collidedWith(Collideable other) { canMoveUp = false; canMoveDown = false; canMoveLeft = false; canMoveRight = false; //setVelocity(new Vector2(0, 0)); }
public override void collidedWith(Collideable other) { game.remove(other); game.remove(this); }
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; }