Beispiel #1
0
 public GameState(GameStateManager gsm,ContentManager content)
 {
     batch = Game1.spriteBatch;
     graphics = Game1.graphics;
     this.gsm = gsm;
     this.content = content;
 }
        public LevelSelectState(GameStateManager gsm, ContentManager content)
            : base(gsm, content)
        {
            hover = 0;
            lastkeyb = Keyboard.GetState();
            aroundrect = new Texture2D(graphics.GraphicsDevice, 55, 50);

            Color[] arr = new Color[aroundrect.Width * aroundrect.Height];
            for (int i = 0; i < aroundrect.Height; i++)
            {
                for (int j = 0; j < aroundrect.Width; j++)
                {
                    if (j == 0 || j == aroundrect.Width - 1 || i == 0 || i == aroundrect.Height - 1)
                    {
                        arr[j + i * aroundrect.Width] = Color.White;
                    }
                }
            }
            aroundrect.SetData<Color>(arr);
            dice = new Random();

            back = "Back to menu";
            time = 0;

            bgcolor = Color.Blue;
        }
 public PauseState(GameStateManager gsm, ContentManager content)
     : base(gsm, content)
 {
     hover = 0;
     towrite = new String[3];
     towrite[0] = "Resume";
     towrite[1] = "Back to level select";
     towrite[2] = "Quit to dekstop";
     lastkeyb = Keyboard.GetState();
 }
Beispiel #4
0
        public PlayState(GameStateManager gsm,ContentManager content)
            : base(gsm,content)
        {
            map = new Map(content.Load<Texture2D>("data/blocks"));
            player = new Player(content.Load<Texture2D>("data/arr"));
            keyb = Keyboard.GetState();

            gsm.addPublicObj(Consts.MAPOBJ,map);
            gsm.addPublicObj(Consts.PLAYEROBJ,player);
        }
Beispiel #5
0
        public MenuState(GameStateManager gsm, ContentManager content)
            : base(gsm, content)
        {
            lastkeyb = Keyboard.GetState();
            towrite = new String[2];

            towrite[0] = "Play";
            towrite[1] = "Exit to desktop";
            hover = 0;

            dice = new Random();

            time = 0;
            bgcolor = Color.Blue;
        }
Beispiel #6
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            font = Content.Load<SpriteFont>("data/defaultfont");
            boldfont = Content.Load<SpriteFont>("data/boldfont");

            spriteBatch = new SpriteBatch(GraphicsDevice);
            cam = new Camera2d(GraphicsDevice.Viewport);

            gsm = new GameStateManager(this.Content);
            gsm.loadContent();

            // TODO: use this.Content to load your game content here
        }