Example #1
0
 public GameWorld(Shooter game)
     : base(game)
 {
     entities = new List<Entity>();
     temp = new List<Action>();
     camera = new Camera(0,0);
 }
Example #2
0
        /// <summary>
        /// Used to draw the blocks and background
        /// </summary>
        /// <param name="Camer"></param>
        public void Draw(Camera Camer)
        {
            //Draw Background
            Engine.SpriteBatch.Draw(Background, new Vector2(0, 0), new Vector2(Engine.WindowWidth, Engine.WindowHeight), 0, null, Vector2.Zero, 0, AlphaColor.White);

            //Draw blocks
            for (int i = 0; i < GridTexture.Length; i++)
            {
                if (GridTexture[i] != -1)
                {
                    int x = i % GridSize.X;
                    int y = i / GridSize.X;
                    Camer.Draw(Textures[GridTexture[i]], new Vector2(x * GridElementSize.X, y * GridElementSize.Y), GridElementSize, null, AlphaColor.White, 0.5f);
                }
            }

            if (DisplayGrid)
            {
                //Draws grid
                for (int x = 0; x < GridSize.X + 1; x++)
                {
                    Camer.Draw(Texture2D.WhiteTexture(), new Vector2(0, GridElementSize.Y * x), new Vector2(GridElementSize.X * GridSize.X, 1 / Camer.Zoom), null, AlphaColor.Black, 0.51f);
                }
                for (int y = 0; y < GridSize.X + 1; y++)
                {
                    Camer.Draw(Texture2D.WhiteTexture(), new Vector2(GridElementSize.X * y, 0), new Vector2(1 / Camer.Zoom, GridElementSize.Y * GridSize.Y), null, AlphaColor.Black, 0.51f);
                }
            }
        }