Beispiel #1
0
        public static Level buildTestLevel(Texture2D texture)
        {
            Level testLevel = new Level();

            Entity entity = new Entity(0, 20, 800, 30);
            entity.Color = Color.OrangeRed;
            entity.Texture = texture;

            testLevel.addEntity(entity);

            entity = new Entity(40, 75, 32, 32);
            entity.Color = Color.BlanchedAlmond;
            entity.Texture = texture;

            testLevel.addEntity(entity);

            PlayerEntity player = new PlayerEntity(20, 51, 32, 64);
            player.Color = Color.DarkCyan;
            testLevel.Player = player;

            return testLevel;
        }
Beispiel #2
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.
            spriteBatch = new SpriteBatch(GraphicsDevice);
            renderer = new Renderer2D(GraphicsDevice);
            renderer.TextFont = Content.Load<SpriteFont>("default_font");

            Texture2D texture = new Texture2D(GraphicsDevice, 1, 1);
            texture.SetData(new Color[] { Color.White });
            Entity.SetDefaultTexture(texture);

            level = TestLevelBuilder.buildTestLevel(texture);
            Camera camera = new Camera(GraphicsDevice.Viewport);
            camera.Pos = new Vector2(400, 250);
            level.Camera = camera;
            editor = new Editor();
            editor.CurrentLevel = level;

            fps = new FPSCounter();
        }