Esempio n. 1
0
 //creates new player block
 public void newPlayer()
 {
     curPlayer = new PlayerBlock();
     Block.changePlayerColour(curPlayer.getColour());
     if (blockArray[curPlayer.getXCord(), curPlayer.getYCord()].getState() == 1)
     {
         devastation();
     }
 }
Esempio n. 2
0
        public void initialise(Form igloo)
        {
            myForm = igloo;

            bulbasaur                       = new Panel();
            bulbasaur.Size                  = new Size(myForm.Size.Width, myForm.Size.Height - 30);
            bulbasaur.Location              = new Point(0, 0);
            bulbasaur.BackgroundImage       = new Bitmap("../../../images/winScreen.png");
            bulbasaur.BackgroundImageLayout = ImageLayout.Stretch;
            bulbasaur.Visible               = false;
            myForm.Controls.Add(bulbasaur);

            //Setting up the player
            PlayerBlock.initialiseThis(gridMaxY, gridMaxX);
            curPlayer = new PlayerBlock();

            //Set up block class to be usable
            Block.blockInitialise(gridMaxX, gridMaxY, myForm.Size.Width, myForm.Size.Height, myForm);
            Block.changePlayerColour(curPlayer.getColour());

            //Set up the 2D array
            blockArray = new Block[gridMaxX, gridMaxY];

            for (int i = 0; i < gridMaxX; i++)
            {
                for (int counter = 0; counter < gridMaxY; counter++)
                {
                    blockArray[i, counter] = new Block(i, counter);
                }
            }

            //Setting up ghost
            Ghost.setGrid(this);
            ghostArray = new Ghost[ghostNum];
            for (int i = 0; i < ghostNum; i++)
            {
                ghostArray[i] = new Ghost(gridMaxX, gridMaxY, i);
            }

            //Setting up shapes
            shapes = new Cords[7, 4];
            //box
            shapes[0, 0] = new Cords(1, 0);
            shapes[0, 1] = new Cords(1, 1);
            shapes[0, 2] = new Cords(0, 1);
            shapes[0, 3] = new Cords(0, 0);
            //
            shapes[1, 0] = new Cords(0, 1);
            shapes[1, 1] = new Cords(0, 2);
            shapes[1, 2] = new Cords(0, 3);
            shapes[1, 3] = new Cords(0, 0);
            //
            shapes[2, 0] = new Cords(1, 0);
            shapes[2, 1] = new Cords(0, 1);
            shapes[2, 2] = new Cords(0, 2);
            shapes[2, 3] = new Cords(0, 0);
            //
            shapes[3, 0] = new Cords(1, 0);
            shapes[3, 1] = new Cords(1, 1);
            shapes[3, 2] = new Cords(1, 2);
            shapes[3, 3] = new Cords(0, 0);
            //
            shapes[4, 0] = new Cords(1, 0);
            shapes[4, 1] = new Cords(1, 1);
            shapes[4, 2] = new Cords(2, 1);
            shapes[4, 3] = new Cords(0, 0);
            //
            shapes[5, 0] = new Cords(0, 2);
            shapes[5, 1] = new Cords(1, 1);
            shapes[5, 2] = new Cords(0, 1);
            shapes[5, 3] = new Cords(0, 0);
            //
            shapes[6, 0] = new Cords(1, 1);
            shapes[6, 1] = new Cords(0, 1);
            shapes[6, 2] = new Cords(0, 2);
            shapes[6, 3] = new Cords(0, 0);

            placeSounds = new System.Media.SoundPlayer[8];
            for (int i = 0; i < 8; i++)
            {
                placeSounds[i] = new System.Media.SoundPlayer("../../../sounds/place" + (i + 1) + ".wav");
            }

            drawPlayer();
        }