示例#1
0
 protected override void Initialize()
 {
     Map = new Map();
     Camera = new Camera2D(Vector2.Zero, Map.Width - 800, Map.Height - 600);
     Car = new Car(new Vector2(XNAGame.I.Width / 2 + 50, XNAGame.I.Height / 2 + 50));
     Wall = new Wall(new Vector2(XNAGame.I.Width / 2 + 50, XNAGame.I.Height / 2 + 500), 100, 16);
     info = new Text("", "Speed: 0 - Angle: 0", new Vector2(0, 20));
     Music = new Music("track");
     Music.Play(true);
 }
示例#2
0
        protected override void Initialize()
        {
            Background = new Sprite(new Vector2(0, 0));
            Background.Texture = Cache.Picture("bgtitle");

            Title = new Sprite(new Vector2(-900, 50));
            Title.Texture = Cache.Picture("title");

            Car = new Sprite(new Vector2(-300, 100));
            Car.Texture = Cache.Texture("carBlue");

            Music = new Music("mainmenu");
            Music.Play(true);
            Music.Volume = 0.0f;

            Speedway = new Sample("speedway");
            Speedway.Pitch = 0.2f;

            Help = new HelpText(new Vector2(400, 550));
            Help.Alignment = TextAlignment.Center;
            Help.Color = Color.Red;
            Help.Outline = 1;
            Help.AddText("Start driving ASAP");
            Help.AddText("Be the number one!");
            Help.AddText("Change the game options");
            Help.AddText("Exit the game");
            Help.AddText("Sets the music volume level");
            Help.AddText("Sets the sounds volume level");
            Help.AddText("Switch between fullscreen and windowed");
            Help.AddText("Return to the main menu");
            Help.Index = 0;
            Help.Visible = false;

            MainMenu = new CoRe.GUI.WindowCommand.TextOnly(new Vector2(270, 350));
            MainMenu.AddCommand("Quick Race", ClickQuickRace);
            MainMenu.AddCommand("Championship", ClickChampionship);
            MainMenu.AddCommand("Options", ClickOptions);
            MainMenu.AddCommand("Exit", (Command c) => { XNAGame.I.Finish(); });
            MainMenu.Font = "Ethnocentric";
            MainMenu.Spacing = 40;
            MainMenu.Outline = 2;
            MainMenu.MoveSound = "broumbroum__sf3-sfx-menu-select";
            MainMenu.SelectSound = "runnerpack__menusel";

            OptionMenu = new CoRe.GUI.WindowCommand.TextOnly(new Vector2(270, 350));
            OptionMenu.AddCommand("Music Volume: "+((int)Music.DefaultVolume*100).ToString()+"%", ClickMusicVolume);
            OptionMenu.AddCommand("Sounds Volume: "+((int)Sample.DefaultVolume * 100).ToString() + "%", ClickSoundVolume);
            if (XNAGame.Instance.Graphics.IsFullScreen) { OptionMenu.AddCommand("Fullscreen: ON", ClickFullscreen); }
            else { OptionMenu.AddCommand("Fullscreen: OFF", ClickFullscreen); }
            OptionMenu.AddCommand("Back", ClickBack);
            OptionMenu.Font = "Ethnocentric";
            OptionMenu.Spacing = 40;
            OptionMenu.Outline = 2;
            OptionMenu.MoveSound = "broumbroum__sf3-sfx-menu-select";
            OptionMenu.SelectSound = "runnerpack__menusel";

            MainMenu.Off();
            OptionMenu.Off();

            MainMenu.Position = new Vector2((XNAGame.I.Width - MainMenu.Width) / 2, 350);
            OptionMenu.Position = new Vector2((XNAGame.I.Width - OptionMenu.Width) / 2, 350);
            Speedway.Play();
        }