Esempio n. 1
0
        /// <summary>
        /// Loads graphics content for this screen. 
        /// </summary>
        public override void LoadContent()
        {
            if(_content == null)
                _content = new ContentManager(ScreenManager.Game.Services, "Content");

            Viewport viewport = ScreenManager.GraphicsDevice.Viewport;
            var fullscreen = new Rectangle(0, 0, viewport.Width, viewport.Height);

            var button_off_bg = _content.Load<Texture2D>("button_off");
            var button_on_bg = _content.Load<Texture2D>("button_on");
            int width = button_off_bg.Width / 2;
            int height = button_off_bg.Height / 2;
            int shift = height * 2 + 10;
            var blank = _content.Load<Texture2D>("blank");
            int topleftX = fullscreen.Center.X - width;
            int topleftY = fullscreen.Center.Y - 100 - height;

            var btn1 = new Controls.Button(button_on_bg, button_off_bg,
                                          new Vector2(
                                            topleftX,
                                            topleftY),
                                          "NEW GAME");
            btn1.Clicked += (sender, args) => {
                Pilot pilot = new Pilot();
                pilot.Init(10.0, 10.0, 172, 54);
                Ship ship = new Ship(172, 54);
                ScreenManager.RemoveScreen(this);
                ScreenManager.AddScreen(new ShopScreen(pilot), ControllingPlayer);
            };
            btn1.Font = _content.Load<SpriteFont>("menufont");
            _controls.Add(btn1);

            var btn2 = new Controls.Button(button_on_bg, button_off_bg,
                                          new Vector2(
                                            topleftX,
                                            topleftY + shift),
                                          "BACK TO MAIN MENU");
            btn2.Clicked += (sender, args) => {
                ScreenManager.RemoveScreen(this);
                ScreenManager.AddScreen(new MainMenu(), ControllingPlayer);
            };
            btn2.Font = _content.Load<SpriteFont>("menufont");
            _controls.Add(btn2);
        }
Esempio n. 2
0
        //public:
        public void Init(double x, double y, Int32 w, Int32 h)
        {
            _score = 0;
            _exp = 0;
            _expMultiplier = 1;
            _money = 0;
            _moneyMultiplier = 1;
            _level = 1;

            _ship = new Ship(w, h);
            _ship.PosX = x;
            _ship.PosY = y;
        }