public bool collidesWithBroccoli(Broccoli broccoli) { if ((broccoli.Bounds.X < position.X + FRAME_WIDTH) && (position.X < (broccoli.Bounds.X + broccoli.Bounds.Width)) && (broccoli.Bounds.Y < position.Y + FRAME_HEIGHT) && (position.Y < broccoli.Bounds.Y + broccoli.Bounds.Height)) { return(true); } else { return(false); } }
public Game1() { graphics = new GraphicsDeviceManager(this); Content.RootDirectory = "Content"; player = new Player(this); block1 = new Block(this, 0, 300); block2 = new Block(this, 550, 300); block3 = new Block(this, 995, 300); // middle of the new part of the world cake = new Cake(this, 2, random); cookie = new Cookie(this, 1, random); donut = new Donut(this, 5, random); carrot = new Carrot(this, -3, random); broccoli = new Broccoli(this, -5, random); blocks = new List <Block>(); }