Beispiel #1
0
    public GameOver(Player player)
    {
        Button done = new Button("DONE", () => Program.Manager.NextState = new MainMenu(), 50, 200);

        done.Anchor = new Vec2(0.6, 0.2);
        AddExpandElement(done);

        Label Gameover = new Label("GAME OVER", 45);

        Gameover.Anchor = new Vec2(0.5, 0.9);
        Frame.Add(Gameover);

        ElementList names = new ElementList();

        names.Add(new Label("DEATHS", 23));
        names.Add(new Label("KILLS", 23));
        names.Add(new Label("BONUSES", 23));
        names.Horizontal = false;
        names.Anchor     = new Vec2(0.4, 0.5);
        names.Visit((Element e) => e.FixedWidth = 130);
        names.Spacing = 20;
        Frame.Add(names);

        Label p1 = new Label("PLAYER 1", 23);
        Label p2 = new Label("PLAYER 2", 23);

        p1.FixedWidth = 110;
        p2.FixedWidth = 110;
        p1.Anchor     = new Vec2(0.65, 0.75);
        p2.Anchor     = new Vec2(0.85, 0.75);
        Frame.Add(p1);
        Frame.Add(p2);

        ElementList p1stats = new ElementList();

        p1stats.Add(new Label(Program.Statistics.Deaths[0].ToString(), 23));
        p1stats.Add(new Label(Program.Statistics.Kills[0].ToString(), 23));
        p1stats.Add(new Label(Program.Statistics.Bonuses[0].ToString(), 23));
        p1stats.Horizontal = false;
        p1stats.Anchor     = new Vec2(0.65, 0.5);
        p1stats.Visit((Element e) => e.FixedWidth = 110);
        p1stats.Spacing = 20;
        Frame.Add(p1stats);

        ElementList p2stats = new ElementList();

        p2stats.Add(new Label(Program.Statistics.Deaths[1].ToString(), 23));
        p2stats.Add(new Label(Program.Statistics.Kills[1].ToString(), 23));
        p2stats.Add(new Label(Program.Statistics.Bonuses[1].ToString(), 23));
        p2stats.Horizontal = false;
        p2stats.Anchor     = new Vec2(0.85, 0.5);
        p2stats.Visit((Element e) => e.FixedWidth = 110);
        p2stats.Spacing = 20;
        Frame.Add(p2stats);

        player.Dir   = 1;
        Winner       = new Walking(player);
        cam.Position = player.Position + new Vec2(40, 0);
    }
Beispiel #2
0
    public EditControls()
    {
        Label p1    = new Label("PLAYER 1", 20);
        Label p2    = new Label("PLAYER 2", 20);
        Label left  = new Label("LEFT", 20);
        Label right = new Label("RIGHT", 20);
        Label down  = new Label("DOWN", 20);
        Label jump  = new Label("JUMP", 20);
        Label bonus = new Label("BONUS", 20);
        Label sword = new Label("SWORD", 20);

        ElementList list = new ElementList();

        list.Add(left);
        list.Add(right);
        list.Add(down);
        list.Add(jump);
        list.Add(bonus);
        list.Add(sword);
        list.Anchor     = new Vec2(0.25, 0.6);
        list.Horizontal = false;
        list.Visit((Element e) => { e.FixedWidth = 150; });

        P1Left  = new Button(Program.Settings.P1Left.ToString(), () => { Program.Manager.PushState(new KeyPress(SetP1Left)); }, 20, 100);
        P1Right = new Button(Program.Settings.P1Right.ToString(), () => { Program.Manager.PushState(new KeyPress(SetP1Right)); }, 20, 100);
        P1Down  = new Button(Program.Settings.P1Down.ToString(), () => { Program.Manager.PushState(new KeyPress(SetP1Down)); }, 20, 100);
        P1Jump  = new Button(Program.Settings.P1Jump.ToString(), () => { Program.Manager.PushState(new KeyPress(SetP1Jump)); }, 20, 100);
        P1Bonus = new Button(Program.Settings.P1Bonus.ToString(), () => { Program.Manager.PushState(new KeyPress(SetP1Bonus)); }, 20, 100);
        P1Sword = new Button(Program.Settings.P1Sword.ToString(), () => { Program.Manager.PushState(new KeyPress(SetP1Sword)); }, 20, 100);
        P2Left  = new Button(Program.Settings.P2Left.ToString(), () => { Program.Manager.PushState(new KeyPress(SetP2Left)); }, 20, 200);
        P2Right = new Button(Program.Settings.P2Right.ToString(), () => { Program.Manager.PushState(new KeyPress(SetP2Right)); }, 20, 200);
        P2Down  = new Button(Program.Settings.P2Down.ToString(), () => { Program.Manager.PushState(new KeyPress(SetP2Down)); }, 20, 200);
        P2Jump  = new Button(Program.Settings.P2Jump.ToString(), () => { Program.Manager.PushState(new KeyPress(SetP2Jump)); }, 20, 200);
        P2Bonus = new Button(Program.Settings.P2Bonus.ToString(), () => { Program.Manager.PushState(new KeyPress(SetP2Bonus)); }, 20, 200);
        P2Sword = new Button(Program.Settings.P2Sword.ToString(), () => { Program.Manager.PushState(new KeyPress(SetP2Sword)); }, 20, 200);

        ElementList p1list = new ElementList();

        p1list.Add(P1Left);
        p1list.Add(P1Right);
        p1list.Add(P1Down);
        p1list.Add(P1Jump);
        p1list.Add(P1Bonus);
        p1list.Add(P1Sword);
        p1list.Anchor     = new Vec2(0.55, 0.6);
        p1list.Horizontal = false;
        p1list.Visit((Element e) => { e.FixedWidth = 100; });

        ElementList p2list = new ElementList();

        p2list.Add(P2Left);
        p2list.Add(P2Right);
        p2list.Add(P2Down);
        p2list.Add(P2Jump);
        p2list.Add(P2Bonus);
        p2list.Add(P2Sword);
        p2list.Anchor     = new Vec2(0.8, 0.6);
        p2list.Horizontal = false;
        p2list.Visit((Element e) => { e.FixedWidth = 100; });

        p1.Anchor = new Vec2(0.55, 0.9);
        p2.Anchor = new Vec2(0.8, 0.9);

        Button Done = new Button("DONE", () =>
        {
            Close();
            Program.Manager.NextState = new MainMenu();
        }, 50, 150);

        Done.Anchor = new Vec2(0.5, 0.2);
        AddElement(Done);

        AddElement(list);
        AddElement(p1);
        AddElement(p2);
        AddElement(p1list);
        AddElement(p2list);
    }