public MenuDisplay(GraphicsContext graphicsContext)
        {
            graphics = graphicsContext;
            UISystem.Initialize(graphics);
            Scene scene = new Scene();

            announcement = new Label();
            announcement.X = 0;
            announcement.Y = graphics.Screen.Rectangle.Height / 2 - announcement.TextHeight / 2 - 200;
            announcement.Width = graphics.Screen.Rectangle.Width;
            announcement.HorizontalAlignment = HorizontalAlignment.Center;
            announcement.Text = "TBA";
            scene.RootWidget.AddChildLast(announcement);

            announcement2 = new Label();
            announcement2.X = 0;
            announcement2.Y = graphics.Screen.Rectangle.Height / 2 - announcement2.TextHeight / 2;
            announcement2.Width = graphics.Screen.Rectangle.Width;
            announcement2.HorizontalAlignment = HorizontalAlignment.Center;
            announcement2.Text = "TBA";
            scene.RootWidget.AddChildLast(announcement2);

            announcement3 = new Label();
            announcement3.X = 0;
            announcement3.Y = graphics.Screen.Rectangle.Height / 2 - announcement3.TextHeight / 2 + 50;
            announcement3.Width = graphics.Screen.Rectangle.Width;
            announcement3.HorizontalAlignment = HorizontalAlignment.Center;
            announcement3.Text = "TBA";
            scene.RootWidget.AddChildLast(announcement3);

            announcement4 = new Label();
            announcement4.X = 0;
            announcement4.Y = graphics.Screen.Rectangle.Height / 2 - announcement4.TextHeight / 2 + 100;
            announcement4.Width = graphics.Screen.Rectangle.Width;
            announcement4.HorizontalAlignment = HorizontalAlignment.Center;
            announcement4.Text = "TBA";
            scene.RootWidget.AddChildLast(announcement4);

            UISystem.SetScene(scene, null);
        }
Example #2
0
        public static void NewGame(int sc)
        {
            gameOver = false;
            newLevel = true;
            score = sc;

            elf1Tex = new Texture2D("/Application/assets/elf1.png", false);
            elf2Tex = new Texture2D("/Application/assets/elf2.png", false);
            treeTex = new Texture2D("/Application/assets/tree.png", false);
            Texture2D bgTex = new Texture2D ("/Application/assets/snow.png", false);
            Texture2D catTex = new Texture2D ("/Application/assets/santa.png", false);
            Texture2D starTex= new Texture2D ("/Application/assets/house.png", false);
            Texture2D meteorTex= new Texture2D ("/Application/assets/car.png", false);
            Texture2D saucerTex= new Texture2D ("/Application/assets/police.png", false);
            Texture2D clawTex= new Texture2D ("/Application/assets/up_present.png", false);
            Texture2D meowTex = new Texture2D("/Application/assets/left_present.png", false);
            Texture2D hairballTex = new Texture2D("/Application/assets/right_present.png", false);
            gameOverTex = new Texture2D("/Application/assets/game_over.png", false);
            alphabetTex = new Texture2D("/Application/assets/alphabet.png", false);
            selectorTex = new Texture2D("/Application/assets/selector.png", false);

            alpha = new Sprite(graphics, alphabetTex);
            alpha.Position = new Vector3((graphics.Screen.Rectangle.Width / 2 - alpha.Width / 2)+340,
                                      graphics.Screen.Rectangle.Height / 2 - alpha.Height / 2, 0);
            selector = new Sprite(graphics, selectorTex);
            selector.Position = new Vector3((graphics.Screen.Rectangle.Width / 2 - selector.Width / 2) - 175,
                                      graphics.Screen.Rectangle.Height / 2 - selector.Height / 2, 0);

            go = new Sprite (graphics, gameOverTex);
            bg = new Sprite (graphics, bgTex);
            pieces = new List<GameObj> ();
            waiting = new List<Weapon> (); //weapons waiting to be rendered
            p = new Player (graphics, catTex, new Vector3 (30, 450, 0));
            pieces.Add (p);

            //add the enemies
            for( int i=0; i<3;i++){
                pieces.Add (new Star (graphics, starTex, new Vector3 (gen.Next(200,900),gen.Next(200,400),0), p));
                pieces.Add (new Star (graphics, starTex, new Vector3 (gen.Next(200,900),gen.Next(200,400),0), p));
                pieces.Add (new Meteor (graphics, meteorTex, new Vector3(gen.Next(200,900),gen.Next(200,400),0), p));
            }
            pieces.Add (new Saucer (graphics, saucerTex, new Vector3(gen.Next(200,900),gen.Next(200,400),0), p));

            //add weapons to the screne
            cl = new Claw(graphics, clawTex, new Vector3(gen.Next(200,900),gen.Next(200,400),0));
            cl.isActive = false;
            pieces.Add (cl);

            m = new SonicMeow(graphics, meowTex, new Vector3(gen.Next(200,900),gen.Next(200,400),0), new Vector3(0,0,0));
            m.isActive = false;
            pieces.Add (m);

            hb = new HairBall(graphics, hairballTex, new Vector3(gen.Next(200,900),gen.Next(200,400),0));
            hb.isActive = false;
            pieces.Add (hb);

            //to display the score
            UISystem.Initialize (graphics);
            Scene scene = new Scene ();

            scoreLabel = new Label (); //current score
            scoreLabel.X = 320;
            scoreLabel.Y = 10;
            scoreLabel.Width = 300;
            scoreLabel.Text = "Score: " + score;
            scene.RootWidget.AddChildLast (scoreLabel);

            LoadHighScore ();
            hsLabel = new Label (); //high score
            hsLabel.X = 620;
            hsLabel.Y = 10;
            hsLabel.Width = 300;
            hsLabel.Text = "High Score: " + highscore;
            scene.RootWidget.AddChildLast (hsLabel);

            UISystem.SetScene (scene, null);
        }