Example #1
0
        public Game1(GameState state)
        {
            this.state = state;
            GameTime gameTime = new GameTime();
            graphics = new GraphicsDeviceManager(this);
            this.graphics.PreferredBackBufferWidth = 1280;
            this.graphics.PreferredBackBufferHeight = 720;
            this.graphics.IsFullScreen = false;
            Content.RootDirectory = "Content";

            //Create a new instance of the Screen Manager
            screenManager = new ScreenManager(this);
            Components.Add(screenManager);

            //Add two new screens
            screenManager.AddScreen(new BackgroundScreen());
            if (!state.gameStarted)
            {
                screenManager.AddScreen(new MainMenuScreen());
                state.gameStarted = true;
            }
            else
            {
                screenManager.AddScreen(new GameplayScreen(this, state));
            }
        }
Example #2
0
 public GameplayScreen(Game game, GameState state)
 {
     this.game = game;
     this.state = state;
     world = new World((Game1)(game), this, state.mapX, state.mapY);
     animation = new Animation();
     player = new Player(new PlayerState(new Vector2(400, 400), new Vector2()));
     entities = new List<Entity>();
     lantern = new Lantern(player.playerState.position, player, true);
 }