예제 #1
0
        private void Form1_MouseUp(object sender, MouseEventArgs e)
        {
            if (game != null)
            {
                if (game.selectedFruit != null)
                {
                    LittlePlate plate = game.getPlate(e.X, e.Y);
                    if (plate != null)
                    {
                        game.selectedFruit.MoveTo(plate.position.X, plate.position.Y);
                        plate.fruitOn = game.selectedFruit;
                        try
                        {
                            Stream str = Properties.Resources.pop_sound;
                            soundplayer = new SoundPlayer(str);
                            soundplayer.Play();
                        }catch (Exception ex)
                        {
                            MessageBox.Show(ex.Message);
                        }
                    }

                    FruitCollection fCol = game.doc.getFruitCollection(game.selectedFruit.type);
                    fCol.AddFruitLast();
                    fCol.fruits.Remove(game.selectedFruit);
                }

                game.selectedFruit = null;
            }

            Invalidate(true);
        }
예제 #2
0
        public void instantiateList()
        {
            int x = 0, y = 0;

            if (playerID == 0)
            {
                x = Form1.getRatioX(257);
            }
            else
            {
                x = Form1.getRatioX(595);
            }
            y = Form1.getRatioY(215);
            int dx = Form1.getRatioX(41);
            int dy = Form1.getRatioY(47);

            for (int i = 0; i < 10; i++)
            {
                List <LittlePlate> rowPlates = new List <LittlePlate>();
                for (int j = 0; j < 4; j++)
                {
                    LittlePlate littlePlate = new LittlePlate(x + j * dx, y + i * dy, i);
                    if (i == 0)
                    {
                        littlePlate.canBeDrawn = true;
                    }
                    rowPlates.Add(littlePlate);
                }
                plates.Add(rowPlates);
            }
        }
예제 #3
0
        public void removeFromPlate(int x, int y)
        {
            LittlePlate plate = game.getPlate(x, y);

            if (plate != null)
            {
                if (plate.row == game.getActiveRow())
                {
                    plate.fruitOn = null;
                }
            }
        }
예제 #4
0
 public void placeFruit(Fruit fr)
 {
     if (fr != null)
     {
         try
         {
             Stream str = Properties.Resources.pop_sound;
             soundplayer = new SoundPlayer(str);
             soundplayer.Play();
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.Message);
         }
         LittlePlate nextPlate = game.getNextActiveLittlePlate();
         game.selectedFruit = fr;
         if (nextPlate != null)
         {
             fr.MoveTo(nextPlate.position.X, nextPlate.position.Y);
             nextPlate.fruitOn = fr;
         }
     }
 }