Esempio n. 1
0
    public void Change(string name)
    {
        Background1 bg = Array.Find(background, bg1 => bg1.name == name);

        foreach (Background1 bgforchange in background)
        {
            bg.background.SetActive(true);
            if (bgforchange.name != name)
            {
                bgforchange.background.SetActive(false);
            }
        }
    }
Esempio n. 2
0
    void SetupLevel()
    {
        Kanye                = new Sound("Sounds/Kanye/Vintage.mp3", false, false);
        _musicChannel        = Kanye.Play();
        _musicChannel.Volume = 0.10f;

        Background1 background1 = new Background1(0, 0);

        game.AddChild(background1);


        boss2 = new Boss2(1700, 700, player);
        game.AddChild(boss2);

        boss2.HP     = 300;
        player.Lifes = 5;

        HUD_Boss hud = new HUD_Boss(boss2);

        game.AddChild(hud);


        Platform platform1 = new Platform(450, game.height / 2 + 400);

        game.AddChild(platform1);

        Platform platform2 = new Platform(850, game.height / 2 + 100);

        game.AddChild(platform2);

        Platform platform3 = new Platform(1250, game.height / 2 + 400);

        game.AddChild(platform3);


        game.AddChild(player);

        HUD_Player hud_player = new HUD_Player(player);

        game.AddChild(hud_player);

        HUD_Score hud_score = new HUD_Score(mygame);

        game.AddChild(hud_score);
    }
Esempio n. 3
0
 private void Form1_Load(object sender, EventArgs e)
 {
     Background1.SendToBack();
 }
Esempio n. 4
0
        public override void Initialize()
        {
            // set game speed
            SceneManager.RenderContext.GameSpeed = 100;
            random = new Random();

            notes     = new List <Note>();
            longNotes = new List <LongNote>();

            bg = new Background1();
            AddHUDObjectBack(bg);

            pipe = new Pipe("level1\\pipe", 50);
            AddHUDObjectBack(pipe);

            indicator = new Indicator();
            AddHUDObjectFront(indicator);

            text       = new SpriteFonts("font\\font");
            text.Color = Color.SaddleBrown;
            text.Translate(580, 10);
            AddHUDObjectBack(text);

            fire         = new GameButton("level1\\invisbutton", false, false, false);
            fire.CanDraw = false;
            fire.Translate(400, 0);
            fire.OnEnter += () =>
            {
                if (!isFailed && !isFinished)
                {
                    SceneManager.Vibrator.Start(TimeSpan.FromMilliseconds(100));
                    indicator.Pushed();
                    //Debug.WriteLine(MediaPlayer.PlayPosition);
                    if (LongNoteCheck() == 0)
                    {
                        //Debug.WriteLine(mainChar.Sprite.Position.X);
                        SpawnScore(NoteCheck());
                    }
                    else
                    {
                        //Debug.WriteLine(mainChar.Sprite.Position.X);
                        mainChar.LightOnForever();
                        SceneManager.pulse2.Play();
                    }
                }
            };
            fire.OnClick += () =>
            {
                if (!isFailed && !isFinished)
                {
                    //Debug.WriteLine(mainChar.Sprite.Position.X);
                    indicator.Pulled();
                    SpawnScore(NoteCheckOut());
                }
            };
            fire.OnLeave += () =>
            {
                indicator.Pulled();
            };
            AddHUDObjectBack(fire);

            InitiateScoring();
            InitiateNote();
            InitiateLongNote();

            mainChar = new MainCharacter(50, 300, indicator);
            AddSceneObject(mainChar);

            failed        = new GameSprite("level1\\boxfailed");
            failed.Origin = new Vector2(181, 149.5f);
            failed.Translate(400, -300);
            failed.CanDraw = false;
            AddHUDObjectFront(failed);

            finished        = new GameSprite("level1\\boxfinished");
            finished.Origin = new Vector2(230, 181);
            finished.Translate(400, -300);
            finished.CanDraw = false;
            AddHUDObjectFront(finished);

            note       = new SpriteFonts("font\\fontsmall");
            note.Color = Color.Goldenrod;
            note.Translate(265, 280);
            AddHUDObjectFront(note);

            star1        = new GameAnimatedSprite("level1\\star", 12, 40, new Point(73, 73), 6);
            star1.Origin = new Vector2(36.5f, 36.5f);
            star1.Translate(400, -290);
            star1.CanDraw = false;
            AddHUDObjectFront(star1);

            star2        = new GameAnimatedSprite("level1\\star", 12, 40, new Point(73, 73), 6);
            star2.Origin = new Vector2(36.5f, 36.5f);
            star2.Translate(470, -290);
            star2.CanDraw = false;
            AddHUDObjectFront(star2);

            star3        = new GameAnimatedSprite("level1\\star", 12, 40, new Point(73, 73), 6);
            star3.Origin = new Vector2(36.5f, 36.5f);
            star3.Translate(330, -290);
            star3.CanDraw = false;
            AddHUDObjectFront(star3);

            next         = new GameButton("level1\\next", true, false, false);
            next.CanDraw = false;
            next.Translate(420, -215);
            next.OnClick += () =>
            {
                SceneManager.push.Play();
                SceneManager.SetActiveScene("LevelSelect");
                SceneManager.ActiveScene.ResetScene();
                SceneManager.PlaySong(1);
            };
            AddHUDObjectFront(next);

            retry         = new GameButton("level1\\retry", true, false, false);
            retry.CanDraw = false;
            retry.Translate(295, -215);
            retry.OnClick += () =>
            {
            };
            AddHUDObjectFront(retry);

            base.Initialize();
        }