Exemplo n.º 1
0
 public Okno(string filename)
 {
     InitializeComponent();
     Filename = filename;
     Settings sheet = new Settings (Filename,false);
     pudinklinux.Game1 g = new pudinklinux.Game1 ();
     GraphicsDevice dev = g.GraphicsDevice;
     Pudink.TextureSet pud = global::pudink.Graphics.Graphics.Pudink_LoadTextures_Fake(dev);
     Brouk.TextureSet bug = global::pudink.Graphics.Graphics.Brouk_LoadTextures_Fake (dev);
     PowerUp.TextureSet pow = global::pudink.Graphics.Graphics.PowerUp_LoadTextures_Fake (dev);
     Level lvl = new Level (sheet.Contents,ref pud,ref bug,ref pow,2048);
     g.Dispose ();
     pudink = lvl.hrdina;
     hliny = lvl.dirts;
     cesty = lvl.ways;
     bugove = lvl.nepratele;
     vylepseni = lvl.vylepseni;
 }
Exemplo n.º 2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="pudink.Level"/> class.
        /// </summary>
        /// <param name="data">Data sheet.</param>
        /// <param name="ptextury">Pudding textures.</param>
        /// <param name="btextury">Bug textures.</param>
        /// <param name="potextury">Power-up textures.</param>
        /// <param name="view0">View0.</param>
        public Level(Dictionary<string,string[]> data, ref Pudink.TextureSet ptextury,ref Brouk.TextureSet btextury,ref PowerUp.TextureSet potextury,int view0)
        {
            viewY0 = view0;
            Name = data["Name"][0];
            Author = data["Author"][0];
            Date = data["Date"][0];
            string pudink = data["Pudding"][0];
            string[] pudink_props = pudink.Split('|');
            switch(pudink_props[0])
            {
            case "Vanilka":
                hrdina = new Pudink(Pudink.Typ.Vanilka,ptextury);
                break;
            case "Pistacie":
                hrdina = new Pudink(Pudink.Typ.Pistacie,ptextury);
                break;
            case "Cokolada":
                hrdina = new Pudink(Pudink.Typ.Cokolada,ptextury);
                break;
            case "Jahoda":
                hrdina = new Pudink(Pudink.Typ.Jahoda,ptextury);
                break;
            case "Pomeranc":
                hrdina = new Pudink(Pudink.Typ.Pomeranc,ptextury);
                break;
            case "VanocniMix":
                hrdina =new Pudink(Pudink.Typ.VanocniMix,ptextury);
                break;
            }
            int p_X = Convert.ToInt32(pudink_props[1]);
            int p_Y = Convert.ToInt32(pudink_props[2]);
            hrdina.X = p_X * 64;
            hrdina.Y = viewY0 - (p_Y * 64);

            string[] brouci = data["Bug"];
            for(int i = 0; i < brouci.Length; i++)
            {
                string brouk = brouci[i];
                string[] brouk_props = brouk.Split('|');
                Brouk.Typ typ;
                switch (brouk_props[0])
                {
                case "Normal":
                    typ = Brouk.Typ.Normal;
                    break;
                case "Shooting":
                    typ = Brouk.Typ.Shooting;
                    break;
                case "Lava":
                    typ = Brouk.Typ.Lava;
                    break;
                case "Boss":
                    typ = Brouk.Typ.Boss;
                    break;
                default:
                    typ = Brouk.Typ.Normal;
                    break;
                }
                int _X = Convert.ToInt32(brouk_props[1]);
                int _Y = Convert.ToInt32(brouk_props[2]);
                int X = _X * 64;
                int Y = viewY0 - (_Y * 64);
                Brouk a = new Brouk (btextury, typ) {
                    X = X,
                    Y = Y
                };
                nepratele.Add(a);
            }
            string[] powerups = data["PowerUp"];
            for(int i = 0; i < powerups.Length; i++)
            {
                string powerup = powerups[i];
                string[] powerup_props = powerup.Split('|');
                PowerUp.Typ typ;
                switch (powerup_props[0])
                {
                case "Coin":
                    typ = PowerUp.Typ.Coin;
                    break;
                case "Life":
                    typ = PowerUp.Typ.Life;
                    break;
                case "Cokolada":
                    typ = PowerUp.Typ.Cokolada;
                    break;
                case "Jahoda":
                    typ = PowerUp.Typ.Jahoda;
                    break;
                case "Pomeranc":
                    typ = PowerUp.Typ.Pomeranc;
                    break;
                case "Pistacie":
                    typ = PowerUp.Typ.Pistacie;
                    break;
                case "VanocniMix":
                    typ = PowerUp.Typ.VanocniMix;
                    break;
                default:
                    typ = PowerUp.Typ.Coin;
                    break;
                }
                int _X = Convert.ToInt32(powerup_props[1]);
                int _Y = Convert.ToInt32(powerup_props[2]);
                int X = _X * 64;
                int Y = viewY0 - ((_Y * 64)-32);
                PowerUp a = new PowerUp (potextury) {
                    X = X,
                    Y = Y
                };
                a.PowerUpType = typ;
                vylepseni.Add(a);
                a = null;
            }
            string[] hliny = data["Ground"];
            for(int i = 0; i < hliny.Length; i++)
            {
                string hlina = hliny[i];
                string[] hlina_props = hlina.Split('|');
                int _X = Convert.ToInt32(hlina_props[0]);
                int _Y = Convert.ToInt32(hlina_props[1]);
                int X = _X * 64;
                int Y = viewY0 - (_Y * 64);
                dirts.Add(new Hlina(X,Y));
            }

            string[] cesty = data["Way"];
            for(int i = 0; i < cesty.Length; i++)
            {
                string cesta = cesty[i];
                string[] cesta_props = cesta.Split('|');
                int _X = Convert.ToInt32(cesta_props[0]);
                int _Y = Convert.ToInt32(cesta_props[1]);
                int X = _X * 64;
                int Y = viewY0 - (_Y * 64);
                ways.Add(new Cesta(X,Y));
            }
        }
Exemplo n.º 3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="pudink.World"/> class.
 /// </summary>
 /// <param name="settings">Settings.</param>
 /// <param name="pud_textury">Pudding textures.</param>
 /// <param name="bug_textury">Bug textures.</param>
 /// <param name="pow_textury">PowerUp textures.</param>
 public World(Settings settings,ref Pudink.TextureSet pud_textury,ref Brouk.TextureSet bug_textury,ref PowerUp.TextureSet pow_textury)
 {
     sheet = settings;
     pud_textureSet = pud_textury;
     bug_textureSet = bug_textury;
     pow_textureSet = pow_textury;
 }