Пример #1
0
 //Check if the laser has hit any of the blocks in the block-formation. If so, reduce the lives of the block with one and return a "true" so the laser can be removed.
 public bool CollisionCheck(Laser laser)
 {
     for (int j = 0; j < blocks.Count; j++)
     {
         if (laser.Box().Intersects(blocks[j].Box()))
         {
             blocks[j].GetLife--;
             if (blocks[j].GetLife <= 0)
             {
                 blocks.Remove(blocks[j]);
                 j--;
             }
             return true;
         }
     }
     return false;
 }
Пример #2
0
        public Alien(int x, int y)
        {
            position.X = x;
            position.Y = y;

            texture = Global.content.Load<Texture2D>("Textures\\alien");
            //Defines starting point / starting velocity
            rightWall = true;
            leftWall = false;
            velocity.X = 3f;
            velocity.Y = 48f;

            // Laser
            laser = new Laser(x, y);

            alienTextureData =
            new Color[texture.Width * texture.Height];
            texture.GetData(alienTextureData);
        }