예제 #1
0
파일: Player.cs 프로젝트: ttrammell98/Game
 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);
     }
 }
예제 #2
0
 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>();
 }