コード例 #1
0
        public bool AddBlock(Block block)
        {
            if (block != null)
            {
                this.blocks.Add(block);
                TileMap.getTileByIndex((int)block.Index.X, (int)block.Index.Y).AddBlock(block);

                block.HandleInteraction();

                return(true);
            }
            return(false);
        }
コード例 #2
0
ファイル: TileMap.cs プロジェクト: Jemeyr/lizard
        public static void Render(Camera camera, SpriteBatch spriteBatch)
        {
            Vector2 camstart = new Vector2(camera.Position.X, camera.Position.Y);


            for (int i = ((int)camstart.X / TILESIZE); i < ((int)camstart.X / TILESIZE) + 1 + (35); i++)
            {
                if (i < 0 || i > worldSize - 1)
                {
                    continue;
                }
                for (int j = ((int)camstart.Y / TILESIZE); j < ((int)camstart.Y / TILESIZE) + 1 + (20); j++)
                {
                    if (j < 0 || j > worldSize - 1)
                    {
                        continue;
                    }
                    spriteBatch.Draw(Game1.debugTex, new Rectangle(i * TILESIZE, j * TILESIZE, TILESIZE, TILESIZE), TileMap.getTileByIndex(i, j).Passable? new Color(.1f, .9f, .9f, .01f): new Color(1f, 0f, 0f, .11f));
                }
            }
        }