Пример #1
0
        private void positionElements(int width, int height)
        {
            int w = (300 * width) / 1920;
            int h = (300 * height) / 1080;

            w = w / 2;
            h = h / 2;

            for (int i = 0; i < 10; i++)
            {
                MyObject num = new MyObject(i.ToString(), 0, 0, w, h, i.ToString(), 0, false);
                num.isDraw = false;
                myObjects.Add(num);
            }

            MyObject digitOfTens = new MyObject("1", width - (2 * w), 0, w, h, "digitOfTens", 1, false);

            myObjects.Add(digitOfTens);

            MyObject digitOfUnity = new MyObject("1", width - w, 0, w, h, "digitOfUnity", 1, false);

            myObjects.Add(digitOfUnity);


            w   = (400 * width) / 1920;
            h   = (400 * height) / 1080;
            w   = w / 3;
            h   = h / 3;
            hen = new Hen((width / 3), yGround - h, w, h, "kura");

            MyObject tree = new MyObject();

            tree.myName      = "tree";
            w                = (600 * width) / 1920;
            h                = (600 * height) / 1080;
            h                = (600 * height) / 1080;
            w                = (w * 2) / 3;
            h                = (h * 2) / 3;
            tree.width       = w;
            tree.height      = h;
            tree.rectangle   = new Rectangle(width / 10, yGround - h, w, h);
            tree.textureFile = "drzewo";
            tree.levelDraw   = 0;
            myObjects.Add(tree);
            w = (300 * width) / 1920;
            h = (300 * height) / 1080;
            MyObject cloud = new MyObject("chmura", width / 20, height / 20, w, h, "cloud", 1);

            myObjects.Add(cloud);
            MyObject cloud2 = new MyObject("chmura", width * 2, height / 21, w, h, "cloud2", 1);

            myObjects.Add(cloud2);
            MyObject cloud3 = new MyObject("chmura", width / 2, height / 50, w, h, "cloud3", 1);

            myObjects.Add(cloud3);
            w = (w * 3) / 4;
            h = (h * 3) / 4;

            MyObject buttonR = new MyObject("PrzyciskPr", width - w, height - h, w, h, "buttonR", 1);

            myObjects.Add(buttonR);
            MyObject buttonLeft = new MyObject("PrzyciskL", width - (w * 2), height - h, w, h, "buttonLeft", 1);

            myObjects.Add(buttonLeft);
            MyObject buttonUp = new MyObject("PrzyciskW", 0, height - h, w, h, "buttonUp", 1);

            myObjects.Add(buttonUp);

            w = (300 * width) / 1920;
            h = (300 * height) / 1080;
            w = w / 3;
            h = h / 3;
            MyObject butRed = new MyObject("Cg", (width * 4) / 5, (yGround - h) + (h / 10), w, h, "butRed", 0);

            myObjects.Add(butRed);

            w = (400 * width) / 1920;
            h = (400 * height) / 1080;
            w = w / 3;
            h = h / 3;

            MyObject henR = new MyObject("kura", (width / 3), yGround - h, w, h, "henR", 0);

            henR.isDraw = false;
            myObjects.Add(henR);
            hen.rectangle = henR.rectangle;
            henY          = hen.rectangle.Y;
            henYStart     = henY;
            MyObject henL = new MyObject("kuraL", (width / 3), yGround - h, w, h, "henL", 0);

            henL.isDraw = false;
            myObjects.Add(henL);
            MyObject henRU = new MyObject("kuraPG", (width / 3), yGround - h, w, h, "henRU", 0);

            henRU.isDraw = false;
            myObjects.Add(henRU);
            MyObject henLU = new MyObject("kuraLG", (width / 3), yGround - h, w, h, "henLU", 0);

            henLU.isDraw = false;
            myObjects.Add(henLU);
            MyObject henL1 = new MyObject("kuraL_D_0", (width / 3), yGround - h, w, h, "henL1", 0);

            henL1.isDraw = false;
            myObjects.Add(henL1);
            MyObject henL2 = new MyObject("kuraL_D_1", (width / 3), yGround - h, w, h, "henL2", 0);

            henL2.isDraw = false;
            myObjects.Add(henL2);
            MyObject henR1 = new MyObject("kuraP_D_0", (width / 3), yGround - h, w, h, "henR1", 0);

            henR1.isDraw = false;
            myObjects.Add(henR1);
            MyObject henR2 = new MyObject("kuraP_D_1", (width / 3), yGround - h, w, h, "henR2", 0);

            henR2.isDraw = false;
            myObjects.Add(henR2);
            MyObject spiritTexture = new MyObject("kuraDuch", (width / 3), yGround - h, w, h, "spiritTexture", 0);

            spiritTexture.isDraw = false;
            myObjects.Add(spiritTexture);

            w = (300 * width) / 1920;
            h = (300 * height) / 1080;
            MyObject signallerRed = new MyObject("sygnalizacjaCzerwona", (width * 4) / 5, (yGround - h), w, h, "signallerRed", 0);

            myObjects.Add(signallerRed);
            MyObject signallerYellow = new MyObject("sygnalizacjaZolta", (width * 4) / 5, (yGround - h), w, h, "signallerYellow", 0);

            signallerYellow.isDraw = false;
            myObjects.Add(signallerYellow);
            MyObject signallerGreen = new MyObject("sygnalizacjaZielona", (width * 4) / 5, (yGround - h), w, h, "signallerGreen", 0);

            signallerGreen.isDraw = false;
            myObjects.Add(signallerGreen);

            MyObject igly1Tex = new MyObject("igly1", 0, 0, 0, 0, "igly1", 1);

            igly1Tex.isDraw = false;
            myObjects.Add(igly1Tex);
            MyObject igly2Tex = new MyObject("igly2", 0, 0, 0, 0, "igly2", 1);

            igly2Tex.isDraw = false;
            myObjects.Add(igly2Tex);
            MyObject igly0Tex = new MyObject("igly0", 0, 0, 0, 0, "igly0", 1);

            igly0Tex.isDraw = false;
            myObjects.Add(igly0Tex);

            w = (300 * width) / 1920;
            h = (300 * height) / 1080;
            MyObject chickenCoop = new MyObject("kurnik", (width * 2) + (hen.rectangle.X - help.X), (yGround - h), w, h, "coop", 0);

            myObjects.Add(chickenCoop);

            w = (295 * width) / 1920;
            h = (332 * height) / 1080;
            w = w / 5;
            h = h / 5;
            MyObject chicken = new MyObject("chicken", xChicken1, yGround - h, w, h, "chicken1", 0);

            myObjects.Add(chicken);
            MyObject chicken2 = new MyObject("chicken", xChicken2, yChicken2 - h, w, h, "chicken2", 0);

            myObjects.Add(chicken2);
            MyObject smallchicken1 = new MyObject("chicken", width / 100, height / 100, w, h, "smallChicken1", 0);

            smallchicken1.isDraw = false;
            myObjects.Add(smallchicken1);
            MyObject smallchicken2 = new MyObject("chicken", smallchicken1.rectangle.X + (2 * w), smallchicken1.rectangle.Y, w, h, "smallChicken2", 0);

            smallchicken2.isDraw = false;
            myObjects.Add(smallchicken2);
            w = (600 * width) / 1920;
            h = (600 * height) / 1080;
            MyObject mountain = new MyObject("gora", chickenCoop.rectangle.X + chickenCoop.rectangle.Width, yGround - h, w, h, "mountain", 0);

            myObjects.Add(mountain);

            MyObject dimness = new MyObject("PoziomAkcja", 0, 0, background.rectangle.Width, background.rectangle.Height, "dimness", 0);

            dimness.isDraw = false;
            myObjects.Add(dimness);

            w = (600 * width) / 1920;
            h = (600 * height) / 1080;
            w = w / 2;
            h = h / 2;
            w = (2 * w) / 3;
            h = (h * 2) / 3;
            MyObject buttonAgain = new MyObject("przyciskJeszczeRaz", width / 2, (3 * height) / 5, w, h, "buttonAgain", 1);

            buttonAgain.isDraw = false;
            myObjects.Add(buttonAgain);
            MyObject buttonMenu = new MyObject("przyciskStop", buttonAgain.rectangle.X - (3 * buttonAgain.rectangle.Width) / 2, (3 * height) / 5, w, h, "buttonMenu", 1);

            buttonMenu.isDraw = false;
            myObjects.Add(buttonMenu);
            MyObject buttonNextRound = new MyObject("przyciskDalejPoziom", buttonAgain.rectangle.X, buttonAgain.rectangle.Y, w, h, "buttonNextRound", 1);

            buttonNextRound.isDraw = false;
            myObjects.Add(buttonNextRound);

            w = (900 * width) / 1920;
            h = (600 * height) / 1080;
            MyObject captionLose = new MyObject("przegrana", 0, height / 10, w, h, "captionLose", 1, false);

            captionLose.isDraw      = false;
            captionLose.rectangle.X = (width / 2) - (w / 2);
            myObjects.Add(captionLose);
            MyObject captionEndRound = new MyObject("poziomUkonczony", (width / 2) - (w / 2), height / 10, w, h, "captionEndRound", 1, false);

            captionEndRound.isDraw = false;
            myObjects.Add(captionEndRound);

            w = (100 * width) / 1920;
            h = (100 * height) / 1080;
            MyObject goldenStar = new MyObject("gwiazdkaZlota", 0, 0, w, h, "goldenStar", 1, false);

            goldenStar.isDraw = false;
            myObjects.Add(goldenStar);

            MyObject greyStar = new MyObject("gwiazdkaSzara.svg", 0, 0, w, h, "greyStar", 1, false);

            greyStar.isDraw = false;
            myObjects.Add(greyStar);

            MyObject secondStar = new MyObject("gwiazdkaZlota", (width / 2) - (w / 2), height / 20, w, h, "secondStar", 1, false);

            secondStar.isDraw = false;
            myObjects.Add(secondStar);

            MyObject firstStar = new MyObject("gwiazdkaZlota", secondStar.rectangle.X - w, height / 20, w, h, "firstStar", 1, false);

            firstStar.isDraw = false;
            myObjects.Add(firstStar);

            MyObject thirdStar = new MyObject("gwiazdkaZlota", secondStar.rectangle.X + w, height / 20, w, h, "thirdStar", 1, false);

            thirdStar.isDraw = false;
            myObjects.Add(thirdStar);

            MySong mainSound = new MySong("bensound-clearday", "mainSound");

            songs.Add(mainSound);

            MySong choir = new MySong("choir", "choir");

            songs.Add(choir);

            MediaPlayer.MediaStateChanged += MediaPlayer_MediaStateChanged;

            MySoundEffect jumpSound = new MySoundEffect("tap", "jumpSound");

            soundEffects.Add(jumpSound);
        }
Пример #2
0
        private void loadObjects(int width, int height)
        {
            int w = (300 * width) / 1920;
            int h = (300 * height) / 1080;
            w = w / 2;
            h = h / 2;

            for (int i = 0; i < 10; i++)
            {
                MyObject num = new MyObject(i.ToString(), 0, 0, w, h, i.ToString(), 0, false);
                num.isDraw = false;
                myObjects.Add(num);
            }

            MyObject digitOfTens = new MyObject("1", width - (2 * w), 0, w, h, "digitOfTens", 1, false);
            myObjects.Add(digitOfTens);

            MyObject digitOfUnity = new MyObject("1", width - w, 0, w, h, "digitOfUnity", 1, false);
            myObjects.Add(digitOfUnity);

            w = (400 * width) / 1920;
            h = (400 * height) / 1080;
            w = w / 3;
            h = h / 3;
            hen = new Hen((width / 3), yGround - h, w, h, "kura");

            w = (300 * width) / 1920;
            h = (300 * height) / 1080;
            w = (w * 3) / 4;
            h = (h * 3) / 4;
            MyObject buttonR = new MyObject("PrzyciskPr", width - w, height - h, w, h, "buttonR", 1);
            myObjects.Add(buttonR);
            MyObject buttonLeft = new MyObject("PrzyciskL", width - (w * 2), height - h, w, h, "buttonLeft", 1);
            myObjects.Add(buttonLeft);
            MyObject buttonUp = new MyObject("PrzyciskW", 0, height - h, w, h, "buttonUp", 1);
            myObjects.Add(buttonUp);

            w = (400 * width) / 1920;
            h = (400 * height) / 1080;
            w = w / 3;
            h = h / 3;

            MyObject henR = new MyObject("kura", (width / 3), yGround - h, w, h, "henR", 0);
            henR.isDraw = false;
            myObjects.Add(henR);
            hen.rectangle = henR.rectangle;
            henY = hen.rectangle.Y;
            henYStart = henY;
            MyObject henL = new MyObject("kuraL", (width / 3), yGround - h, w, h, "henL", 0);
            henL.isDraw = false;
            myObjects.Add(henL);
            MyObject henRU = new MyObject("kuraPG", (width / 3), yGround - h, w, h, "henRU", 0);
            henRU.isDraw = false;
            myObjects.Add(henRU);
            MyObject henLU = new MyObject("kuraLG", (width / 3), yGround - h, w, h, "henLU", 0);
            henLU.isDraw = false;
            myObjects.Add(henLU);
            MyObject henL1 = new MyObject("kuraL_D_0", (width / 3), yGround - h, w, h, "henL1", 0);
            henL1.isDraw = false;
            myObjects.Add(henL1);
            MyObject henL2 = new MyObject("kuraL_D_1", (width / 3), yGround - h, w, h, "henL2", 0);
            henL2.isDraw = false;
            myObjects.Add(henL2);
            MyObject henR1 = new MyObject("kuraP_D_0", (width / 3), yGround - h, w, h, "henR1", 0);
            henR1.isDraw = false;
            myObjects.Add(henR1);
            MyObject henR2 = new MyObject("kuraP_D_1", (width / 3), yGround - h, w, h, "henR2", 0);
            henR2.isDraw = false;
            myObjects.Add(henR2);

            w = (300 * width) / 1920;
            h = (300 * height) / 1080;
            MyObject chickenCoop = new MyObject("kurnik", (width * 3) / 2 + (hen.rectangle.X - help.X), (yGround - h), w, h, "coop", 0);
            myObjects.Add(chickenCoop);

            w = (600 * width) / 1920;
            h = (600 * height) / 1080;
            MyObject tree = new MyObject("drzewo", width / 10, yGround - h, w, h, "tree", 0);
            myObjects.Add(tree);
            MyObject tree2 = new MyObject("drzewo", (helpX + chickenCoop.rectangle.X) / 2, yGround - h, w, h, "tree", 0);
            myObjects.Add(tree2);


            w = (295 * width) / 1920;
            h = (332 * height) / 1080;
            w = w / 5;
            h = h / 5;
            MyObject chicken = new MyObject("chicken", xChicken + w, yGround - h, w, h, "chicken1", 0);
            myObjects.Add(chicken);
            MyObject chicken2 = new MyObject("chicken", tree2.rectangle.X, yGround - h, w, h, "chicken2", 0);
            myObjects.Add(chicken2);
            MyObject smallchicken1 = new MyObject("chicken", width / 100, height / 100, w, h, "smallChicken1", 0);
            smallchicken1.isDraw = false;
            myObjects.Add(smallchicken1);
            MyObject smallchicken2 = new MyObject("chicken", smallchicken1.rectangle.X + (2 * w), smallchicken1.rectangle.Y, w, h, "smallChicken2", 0);
            smallchicken2.isDraw = false;
            myObjects.Add(smallchicken2);

            w = (400 * width) / 1920;
            h = (400 * height) / 1080;
            w = w / 3;
            h = h / 3;
            MyObject spiritTexture = new MyObject("kuraDuch", (width / 3), yGround - h, w, h, "spiritTexture", 0);
            spiritTexture.isDraw = false;
            myObjects.Add(spiritTexture);

            MyObject dimness = new MyObject("PoziomAkcja", 0, 0, background.rectangle.Width, background.rectangle.Height, "dimness", 0);
            dimness.isDraw = false;
            myObjects.Add(dimness);

            w = (600 * width) / 1920;
            h = (600 * height) / 1080;
            w = w / 2;
            h = h / 2;
            w = (2 * w) / 3;
            h = (h * 2) / 3;
            MyObject buttonAgain = new MyObject("przyciskJeszczeRaz", width / 2, (3 * height) / 5, w, h, "buttonAgain", 0);
            buttonAgain.isDraw = false;
            myObjects.Add(buttonAgain);
            MyObject buttonMenu = new MyObject("przyciskStop", buttonAgain.rectangle.X - (3 * buttonAgain.rectangle.Width) / 2, (3 * height) / 5, w, h, "buttonMenu", 1);
            buttonMenu.isDraw = false;
            myObjects.Add(buttonMenu);
            MyObject buttonNextRound = new MyObject("przyciskDalejPoziom", buttonAgain.rectangle.X, buttonAgain.rectangle.Y, w, h, "buttonNextRound", 1);
            buttonNextRound.isDraw = false;
            myObjects.Add(buttonNextRound);

            w = (900 * width) / 1920;
            h = (600 * height) / 1080;
            MyObject captionLose = new MyObject("przegrana", 0, height / 10, w, h, "captionLose", 1, false);
            captionLose.isDraw = false;
            captionLose.rectangle.X = (width / 2) - (w / 2);
            myObjects.Add(captionLose);
            MyObject captionEndRound = new MyObject("poziomUkonczony", (width / 2) - (w / 2), height / 10, w, h, "captionEndRound", 1, false);
            captionEndRound.isDraw = false;
            myObjects.Add(captionEndRound);

            w = (100 * width) / 1920;
            h = (100 * height) / 1080;
            MyObject goldenStar = new MyObject("gwiazdkaZlota", 0, 0, w, h, "goldenStar", 1, false);
            goldenStar.isDraw = false;
            myObjects.Add(goldenStar);

            MyObject greyStar = new MyObject("gwiazdkaSzara.svg", 0, 0, w, h, "greyStar", 1, false);
            greyStar.isDraw = false;
            myObjects.Add(greyStar);

            MyObject secondStar = new MyObject("gwiazdkaZlota", (width / 2) - (w / 2), height / 20, w, h, "secondStar", 1, false);
            secondStar.isDraw = false;
            myObjects.Add(secondStar);

            MyObject firstStar = new MyObject("gwiazdkaZlota", secondStar.rectangle.X - w, height / 20, w, h, "firstStar", 1, false);
            firstStar.isDraw = false;
            myObjects.Add(firstStar);

            MyObject thirdStar = new MyObject("gwiazdkaZlota", secondStar.rectangle.X + w, height / 20, w, h, "thirdStar", 1, false);
            thirdStar.isDraw = false;
            myObjects.Add(thirdStar);

            //MySong jumpVoice = new MySong("tap", "jumpVoice");
            //songs.Add(jumpVoice);

            MySong choir = new MySong("choir", "choir");
            songs.Add(choir);

            MySong mainSound = new MySong("bensound-hey", "mainSound");
            songs.Add(mainSound);

            MediaPlayer.MediaStateChanged += MediaPlayer_MediaStateChanged;

            MySoundEffect jumpSound = new MySoundEffect("tap", "jumpSound");
            soundEffects.Add(jumpSound);
        }