Esempio n. 1
0
        private void DrawMap(Map map)
        {
            width  = 0;
            height = 0;

            foreach (List <char> line in map.MapProperties)
            {
                foreach (char c in line)
                {
                    switch (c)
                    {
                    case 'X':

                        g.DrawImage(Properties.Resources.wall, width * 32, height * 32);
                        break;

                    case '@':
                        currentPlayerBitmap.MakeTransparent(Color.Transparent);
                        g.DrawImage(Properties.Resources.ground, width * 32, height * 32);
                        g.DrawImage(currentPlayerBitmap, width * 32, height * 32);
                        break;

                    case '*':
                        g.DrawImage(Properties.Resources.box, width * 32, height * 32);
                        break;

                    case ' ':
                        g.DrawImage(Properties.Resources.ground, width * 32, height * 32);
                        break;

                    case '.':
                        g.DrawImage(Properties.Resources.destination, width * 32, height * 32);
                        break;
                    }
                    width++;
                }
                height++;
                tempWidth = width;
                width     = 0;
            }

            panel1.Width  = tempWidth * 32;
            panel1.Height = height * 32;

            label1.Text = "Moves: " + map.MovesCounter;

            if (map.checkIfBoxesDelivered() == true)
            {
                MessageBox.Show("Wygrałeś!!!");
                timer.Stop();
                ResetMap();
                LoadMap();
            }
        }