Ejemplo n.º 1
0
 public PlaceList(Bricks brickList, BlueBricks blueBrickList, Soils soilList,
                  Stones stoneList, Skiers skiList, Bombs bombList, Player trac, Player trac2)
 {
     foreach (Brick br in brickList)
     {
         bricks.AddPlayer(br);
     }
     foreach (BlueBrick br in blueBrickList)
     {
         blueBricks.AddPlayer(br);
     }
     foreach (Soil br in soilList)
     {
         soils.AddPlayer(br);
     }
     foreach (Stone br in stoneList)
     {
         stones.AddPlayer(br);
     }
     foreach (Skier br in skiList)
     {
         skiers.AddPlayer(br);
     }
     foreach (Bomb br in bombList)
     {
         bombs.AddPlayer(br);
     }
     thisPlayer  = trac;
     thisPlayer2 = trac2;
 }
Ejemplo n.º 2
0
 public void SetList(ref Bricks brickList, ref BlueBricks blueBrickList, ref Soils soilList,
                     ref Stones stoneList, ref Skiers skiList, ref Bombs bombList, ref Player trac, ref Player trac2)
 {
     foreach (Brick br in bricks)
     {
         brickList.AddPlayer(br);
     }
     foreach (BlueBrick br in blueBricks)
     {
         blueBrickList.AddPlayer(br);
     }
     foreach (Soil br in soils)
     {
         soilList.AddPlayer(br);
     }
     foreach (Stone br in stones)
     {
         stoneList.AddPlayer(br);
     }
     foreach (Skier br in skiers)
     {
         skiList.AddPlayer(br);
     }
     foreach (Bomb br in bombs)
     {
         bombList.AddPlayer(br);
     }
     trac  = thisPlayer;
     trac2 = thisPlayer2;
 }
Ejemplo n.º 3
0
        public Boolean Moving(System.Windows.Forms.KeyPressEventArgs e,
                              Soils soilList, Stones stoneList, Bombs bombList)
        {
            if ((e.KeyChar.ToString() == "p") || (e.KeyChar.ToString() == "ç"))
            {
                BombNowCreate = true;
                if ((myDirection == Direction.Left) &&
                    (Map.GetItem(this.TOP / 25, this.LEFT / 25 - 1) == ItemName.Null))//left
                {
                    Bomb currentBomb = new Bomb(left / 25 - 1, top / 25);
                    bombList.AddPlayer(currentBomb);

                    Map.SetItem(this.TOP / 25, this.LEFT / 25 - 1, ItemName.Bomb);
                    Map.SetInd(this.TOP / 25, this.LEFT / 25 - 1, bombList.IndexOf(currentBomb));
                }
                if ((myDirection == Direction.Right) &&
                    (Map.GetItem(this.TOP / 25, this.LEFT / 25 + 1) == ItemName.Null))//right
                {
                    Bomb currentBomb = new Bomb(left / 25 + 1, top / 25);
                    bombList.AddPlayer(currentBomb);

                    Map.SetItem(this.TOP / 25, this.LEFT / 25 + 1, ItemName.Bomb);
                    Map.SetInd(this.TOP / 25, this.LEFT / 25 + 1, bombList.IndexOf(currentBomb));
                }
                if ((myDirection == Direction.Up) &&
                    (Map.GetItem(this.TOP / 25 - 1, this.LEFT / 25) == ItemName.Null))//up
                {
                    Bomb currentBomb = new Bomb(left / 25, top / 25 - 1);
                    bombList.AddPlayer(currentBomb);

                    Map.SetItem(this.TOP / 25 - 1, this.LEFT / 25, ItemName.Bomb);
                    Map.SetInd(this.TOP / 25 - 1, this.LEFT / 25, bombList.IndexOf(currentBomb));
                }
                if ((myDirection == Direction.Down) &&
                    (Map.GetItem(this.TOP / 25 + 1, this.LEFT / 25) == ItemName.Null))  //down
                {
                    Bomb currentBomb = new Bomb(left / 25, top / 25 + 1);
                    bombList.AddPlayer(currentBomb);

                    Map.SetItem(this.TOP / 25 + 1, this.LEFT / 25, ItemName.Bomb);
                    Map.SetInd(this.TOP / 25 + 1, this.LEFT / 25, bombList.IndexOf(currentBomb));
                }
                return(false);
            }
            else if ((e.KeyChar.ToString() == "a") || (e.KeyChar.ToString() == "ô"))
            {
                RemoveLeftSoil(soilList);
                if ((Map.GetItem(this.TOP / 25, this.LEFT / 25 - 1) == ItemName.Stone) &&
                    (Map.GetItem(this.TOP / 25, this.LEFT / 25 - 2) == ItemName.Null))             //left stone
                {
                    foreach (Stone st in stoneList)
                    {
                        if ((st.LEFT == this.LEFT - 25) && (st.TOP == this.TOP))
                        {
                            Map.SetItem(st.TOP / 25, st.LEFT / 25, ItemName.Null);
                            st.LEFT -= 25;
                            Map.SetItem(st.TOP / 25, st.LEFT / 25, ItemName.Stone);
                        }
                    }
                }
                else if ((Map.GetItem(this.TOP / 25, this.LEFT / 25 - 1) == ItemName.Bomb) &&
                         (Map.GetItem(this.TOP / 25, this.LEFT / 25 - 2) == ItemName.Null))        //left bomb
                {
                    foreach (Bomb st in bombList)
                    {
                        if ((st.LEFT == this.LEFT - 25) && (st.TOP == this.TOP))
                        {
                            Map.SetItem(st.TOP / 25, st.LEFT / 25, ItemName.Null);
                            st.LEFT -= 25;
                            Map.SetItem(st.TOP / 25, st.LEFT / 25, ItemName.Bomb);
                        }
                    }
                }
                if (Map.GetItem(this.TOP / 25, this.LEFT / 25 - 1) == ItemName.Null)         //left
                {
                    left       -= size;
                    player      = new Bitmap("PlayerLeft.bmp");
                    myDirection = Direction.Left;
                    return(true);
                }
            }
            else if ((e.KeyChar.ToString() == "d") || (e.KeyChar.ToString() == "â"))
            {
                RemoveRightSoil(soilList);
                if ((Map.GetItem(this.TOP / 25, this.LEFT / 25 + 1) == ItemName.Stone) &&
                    (Map.GetItem(this.TOP / 25, this.LEFT / 25 + 2) == ItemName.Null))             //left stone
                {
                    foreach (Stone st in stoneList)
                    {
                        if ((st.LEFT == this.LEFT + 25) && (st.TOP == this.TOP))
                        {
                            Map.SetItem(st.TOP / 25, st.LEFT / 25, ItemName.Null);
                            st.LEFT += 25;
                            Map.SetItem(st.TOP / 25, st.LEFT / 25, ItemName.Stone);
                        }
                    }
                }
                else if ((Map.GetItem(this.TOP / 25, this.LEFT / 25 + 1) == ItemName.Bomb) &&
                         (Map.GetItem(this.TOP / 25, this.LEFT / 25 + 2) == ItemName.Null))        //left bomb
                {
                    foreach (Bomb st in bombList)
                    {
                        if ((st.LEFT == this.LEFT + 25) && (st.TOP == this.TOP))
                        {
                            Map.SetItem(st.TOP / 25, st.LEFT / 25, ItemName.Null);
                            st.LEFT += 25;
                            Map.SetItem(st.TOP / 25, st.LEFT / 25, ItemName.Bomb);
                        }
                    }
                }
                if (Map.GetItem(this.TOP / 25, this.LEFT / 25 + 1) == ItemName.Null)         //right
                {
                    left       += size;
                    player      = new Bitmap("PlayerRight.bmp");
                    myDirection = Direction.Right;
                    return(true);
                }
            }
            else if ((e.KeyChar.ToString() == "w") || (e.KeyChar.ToString() == "ö"))
            {
                RemoveUpSoil(soilList);
                if (Map.GetItem(this.TOP / 25 - 1, this.LEFT / 25) == ItemName.Null)         //up
                {
                    top        -= size;
                    player      = new Bitmap("PlayerUp.bmp");
                    myDirection = Direction.Up;
                    return(true);
                }
            }
            else if ((e.KeyChar.ToString() == "s") || (e.KeyChar.ToString() == "û"))
            {
                RemoveDownSoil(soilList);
                if (Map.GetItem(this.TOP / 25 + 1, this.LEFT / 25) == ItemName.Null)            //down
                {
                    top        += size;
                    player      = new Bitmap("PlayerDown.bmp");
                    myDirection = Direction.Down;
                    return(true);
                }
            }
            return(false);
        }
Ejemplo n.º 4
0
 public Boolean Moving(String str, Soils soilList, Stones stoneList, Bombs bombList)
 {
     if (str == "Bomb")
     {
         if ((myDirection == Direction.Left) &&
             (Map.GetItem(this.TOP / 25, this.LEFT / 25 - 1) == ItemName.Null))             //left
         {
             bombList.AddPlayer(new Bomb(left / 25 - 1, top / 25));
         }
         if ((myDirection == Direction.Right) &&
             (Map.GetItem(this.TOP / 25, this.LEFT / 25 + 1) == ItemName.Null))             //right
         {
             bombList.AddPlayer(new Bomb(left / 25 + 1, top / 25));
         }
         if ((myDirection == Direction.Up) &&
             (Map.GetItem(this.TOP / 25 - 1, this.LEFT / 25) == ItemName.Null))             //up
         {
             bombList.AddPlayer(new Bomb(left / 25, top / 25 - 1));
         }
         if ((myDirection == Direction.Down) &&
             (Map.GetItem(this.TOP / 25 + 1, this.LEFT / 25) == ItemName.Null))                  //down
         {
             bombList.AddPlayer(new Bomb(left / 25, top / 25 + 1));
         }
     }
     else if (str == "Left")
     {
         RemoveLeftSoil(soilList);
         if (Map.GetItem(this.TOP / 25, this.LEFT / 25 - 1) == ItemName.Null)         //left
         {
             left       -= size;
             player      = new Bitmap("ClientLeft.bmp");
             myDirection = Direction.Left;
             return(true);
         }
     }
     else if (str == "Right")
     {
         RemoveRightSoil(soilList);
         if (Map.GetItem(this.TOP / 25, this.LEFT / 25 + 1) == ItemName.Null)         //right
         {
             left       += size;
             player      = new Bitmap("ClientRight.bmp");
             myDirection = Direction.Right;
             return(true);
         }
     }
     else if (str == "Up")
     {
         RemoveUpSoil(soilList);
         if (Map.GetItem(this.TOP / 25 - 1, this.LEFT / 25) == ItemName.Null)         //up
         {
             top        -= size;
             player      = new Bitmap("ClientUp.bmp");
             myDirection = Direction.Up;
             return(true);
         }
     }
     else if (str == "Down")
     {
         RemoveDownSoil(soilList);
         if (Map.GetItem(this.TOP / 25 + 1, this.LEFT / 25) == ItemName.Null)            //down
         {
             top        += size;
             player      = new Bitmap("ClientDown.bmp");
             myDirection = Direction.Down;
             return(true);
         }
     }
     return(false);
 }
Ejemplo n.º 5
0
        private void On_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e)
        {
            if (IsCreateNewMap == true)
            {
                Int32 x;
                Int32 y;
                x = e.X / 25;
                y = e.Y / 25;
                switch (SelectedItem)
                {
                case "Player1":
                    trac = new Player(x, y, "PlayerRight.bmp");
                    menuItemPlayer1.Enabled = false;
                    SelectedItem            = "NULL";
                    break;

                case "Player2":
                    trac2 = new Player(x, y, "ClientRight.bmp");
                    menuItemPlayer2.Enabled = false;
                    SelectedItem            = "NULL";
                    break;

                case "SkiLeft":
                    skiList.AddPlayer(new Skier(x, y, "SkierLeft.bmp", Direction.Left));
                    break;

                case "SkiRight":
                    skiList.AddPlayer(new Skier(x, y, "SkierRight.bmp", Direction.Right));
                    break;

                case "SkiUp":
                    skiList.AddPlayer(new Skier(x, y, "SkierUp.bmp", Direction.Up));
                    break;

                case "SkiDown":
                    skiList.AddPlayer(new Skier(x, y, "SkierDown.bmp", Direction.Down));
                    break;

                case "Bomb":
                    bombList.AddPlayer(new Bomb(x, y));
                    break;

                case "Stone":
                    stoneList.AddPlayer(new Stone(x, y));
                    break;

                case "Soil":
                    soilList.AddPlayer(new Soil(x, y));
                    break;

                case "Brick":
                    brickList.AddPlayer(new Brick(x, y));
                    break;

                case "BlueBrick":
                    blueBrickList.AddPlayer(new BlueBrick(x, y));
                    break;
                }
                InvalidateThis(x, y);
            }
        }
Ejemplo n.º 6
0
 public Boolean Moving(System.Windows.Forms.KeyPressEventArgs e,
                       Soils soilList, Stones stoneList, Bombs bombList)
 {
     if ((e.KeyChar.ToString() == "p") || (e.KeyChar.ToString() == "ç"))
     {
         BombNowCreate = true;
         if ((myDirection == Direction.Left) &&
             (Map.GetItem(this.TOP / 25, this.LEFT / 25 - 1) == ItemName.Null))             //left
         {
             bombList.AddPlayer(new Bomb(left / 25 - 1, top / 25));
         }
         if ((myDirection == Direction.Right) &&
             (Map.GetItem(this.TOP / 25, this.LEFT / 25 + 1) == ItemName.Null))             //right
         {
             bombList.AddPlayer(new Bomb(left / 25 + 1, top / 25));
         }
         if ((myDirection == Direction.Up) &&
             (Map.GetItem(this.TOP / 25 - 1, this.LEFT / 25) == ItemName.Null))             //up
         {
             bombList.AddPlayer(new Bomb(left / 25, top / 25 - 1));
         }
         if ((myDirection == Direction.Down) &&
             (Map.GetItem(this.TOP / 25 + 1, this.LEFT / 25) == ItemName.Null))                  //down
         {
             bombList.AddPlayer(new Bomb(left / 25, top / 25 + 1));
         }
     }
     else if ((e.KeyChar.ToString() == "a") || (e.KeyChar.ToString() == "ô"))
     {
         RemoveLeftSoil(soilList);
         if (Map.GetItem(this.TOP / 25, this.LEFT / 25 - 1) == ItemName.Null)         //left
         {
             left       -= size;
             player      = new Bitmap("ClientLeft.bmp");
             myDirection = Direction.Left;
             return(true);
         }
     }
     else if ((e.KeyChar.ToString() == "d") || (e.KeyChar.ToString() == "â"))
     {
         RemoveRightSoil(soilList);
         if (Map.GetItem(this.TOP / 25, this.LEFT / 25 + 1) == ItemName.Null)         //right
         {
             left       += size;
             player      = new Bitmap("ClientRight.bmp");
             myDirection = Direction.Right;
             return(true);
         }
     }
     else if ((e.KeyChar.ToString() == "w") || (e.KeyChar.ToString() == "ö"))
     {
         RemoveUpSoil(soilList);
         if (Map.GetItem(this.TOP / 25 - 1, this.LEFT / 25) == ItemName.Null)         //up
         {
             top        -= size;
             player      = new Bitmap("ClientUp.bmp");
             myDirection = Direction.Up;
             return(true);
         }
     }
     else if ((e.KeyChar.ToString() == "s") || (e.KeyChar.ToString() == "û"))
     {
         RemoveDownSoil(soilList);
         if (Map.GetItem(this.TOP / 25 + 1, this.LEFT / 25) == ItemName.Null)            //down
         {
             top        += size;
             player      = new Bitmap("ClientDown.bmp");
             myDirection = Direction.Down;
             return(true);
         }
     }
     return(false);
 }
Ejemplo n.º 7
0
 public Boolean Moving(String str, Soils soilList, Stones stoneList, Bombs bombList)
 {
     if (str == "Bomb")
     {
         if ((myDirection == Direction.Left) &&
             (Map.GetItem(this.TOP / 25, this.LEFT / 25 - 1) == ItemName.Null))             //left
         {
             bombList.AddPlayer(new Bomb(left / 25 - 1, top / 25));
         }
         if ((myDirection == Direction.Right) &&
             (Map.GetItem(this.TOP / 25, this.LEFT / 25 + 1) == ItemName.Null))             //right
         {
             bombList.AddPlayer(new Bomb(left / 25 + 1, top / 25));
         }
         if ((myDirection == Direction.Up) &&
             (Map.GetItem(this.TOP / 25 - 1, this.LEFT / 25) == ItemName.Null))             //up
         {
             bombList.AddPlayer(new Bomb(left / 25, top / 25 - 1));
         }
         if ((myDirection == Direction.Down) &&
             (Map.GetItem(this.TOP / 25 + 1, this.LEFT / 25) == ItemName.Null))                  //down
         {
             bombList.AddPlayer(new Bomb(left / 25, top / 25 + 1));
         }
     }
     else if (str == "Left")
     {
         RemoveLeftSoil(soilList);
         if ((Map.GetItem(this.TOP / 25, this.LEFT / 25 - 1) == ItemName.Stone) &&
             (Map.GetItem(this.TOP / 25, this.LEFT / 25 - 2) == ItemName.Null))             //left stone
         {
             foreach (Stone st in stoneList)
             {
                 if ((st.LEFT == this.LEFT - 25) && (st.TOP == this.TOP))
                 {
                     Map.SetItem(st.TOP / 25, st.LEFT / 25, ItemName.Null);
                     st.LEFT -= 25;
                     Map.SetItem(st.TOP / 25, st.LEFT / 25, ItemName.Stone);
                 }
             }
         }
         else if ((Map.GetItem(this.TOP / 25, this.LEFT / 25 - 1) == ItemName.Bomb) &&
                  (Map.GetItem(this.TOP / 25, this.LEFT / 25 - 2) == ItemName.Null))        //left bomb
         {
             foreach (Bomb st in bombList)
             {
                 if ((st.LEFT == this.LEFT - 25) && (st.TOP == this.TOP))
                 {
                     Map.SetItem(st.TOP / 25, st.LEFT / 25, ItemName.Null);
                     st.LEFT -= 25;
                     Map.SetItem(st.TOP / 25, st.LEFT / 25, ItemName.Bomb);
                 }
             }
         }
         if (Map.GetItem(this.TOP / 25, this.LEFT / 25 - 1) == ItemName.Null)         //left
         {
             left       -= size;
             player      = new Bitmap("PlayerLeft.bmp");
             myDirection = Direction.Left;
             return(true);
         }
     }
     else if (str == "Right")
     {
         RemoveRightSoil(soilList);
         if ((Map.GetItem(this.TOP / 25, this.LEFT / 25 + 1) == ItemName.Stone) &&
             (Map.GetItem(this.TOP / 25, this.LEFT / 25 + 2) == ItemName.Null))             //left stone or bomb
         {
             foreach (Stone st in stoneList)
             {
                 if ((st.LEFT == this.LEFT + 25) && (st.TOP == this.TOP))
                 {
                     Map.SetItem(st.TOP / 25, st.LEFT / 25, ItemName.Null);
                     st.LEFT += 25;
                     Map.SetItem(st.TOP / 25, st.LEFT / 25, ItemName.Stone);
                 }
             }
         }
         else if ((Map.GetItem(this.TOP / 25, this.LEFT / 25 + 1) == ItemName.Bomb) &&
                  (Map.GetItem(this.TOP / 25, this.LEFT / 25 + 2) == ItemName.Null))        //left bomb
         {
             foreach (Bomb st in bombList)
             {
                 if ((st.LEFT == this.LEFT + 25) && (st.TOP == this.TOP))
                 {
                     Map.SetItem(st.TOP / 25, st.LEFT / 25, ItemName.Null);
                     st.LEFT += 25;
                     Map.SetItem(st.TOP / 25, st.LEFT / 25, ItemName.Bomb);
                 }
             }
         }
         if (Map.GetItem(this.TOP / 25, this.LEFT / 25 + 1) == ItemName.Null)         //right
         {
             left       += size;
             player      = new Bitmap("PlayerRight.bmp");
             myDirection = Direction.Right;
             return(true);
         }
     }
     else if (str == "Up")
     {
         RemoveUpSoil(soilList);
         if (Map.GetItem(this.TOP / 25 - 1, this.LEFT / 25) == ItemName.Null)         //up
         {
             top        -= size;
             player      = new Bitmap("PlayerUp.bmp");
             myDirection = Direction.Up;
             return(true);
         }
     }
     else if (str == "Down")
     {
         RemoveDownSoil(soilList);
         if (Map.GetItem(this.TOP / 25 + 1, this.LEFT / 25) == ItemName.Null)            //down
         {
             top        += size;
             player      = new Bitmap("PlayerDown.bmp");
             myDirection = Direction.Down;
             return(true);
         }
     }
     return(false);
 }