reorganized the content folder and fixed some bugs in the content readers

This commit is contained in:
Dylan Wilson
2015-10-14 20:56:32 +10:00
parent 4d9689caaa
commit 1c8aab7aab
36 changed files with 269 additions and 188 deletions
@@ -2,6 +2,7 @@ using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics;
using MonoGame.Extended.Content;
using MonoGame.Extended.TextureAtlases;
namespace MonoGame.Extended.BitmapFonts
@@ -10,7 +11,7 @@ namespace MonoGame.Extended.BitmapFonts
{
protected override BitmapFont Read(ContentReader reader, BitmapFont existingInstance)
{
var relativeAssetFolder = GetRelativeAssetFolder(reader.AssetName);
var assetDirectory = ContentTypeReaderHelper.GetDirectory(reader.AssetName);
var textureAssetCount = reader.ReadInt32();
var assets = new List<string>();
@@ -21,7 +22,7 @@ namespace MonoGame.Extended.BitmapFonts
}
var textures = assets
.Select(assetName => reader.ContentManager.Load<Texture2D>(relativeAssetFolder + assetName))
.Select(textureName => reader.ContentManager.Load<Texture2D>(assetDirectory + textureName))
.ToArray();
var lineHeight = reader.ReadInt32();
@@ -45,15 +46,5 @@ namespace MonoGame.Extended.BitmapFonts
return new BitmapFont(regions, lineHeight);
}
private string GetRelativeAssetFolder(string assetPath)
{
var pathNodes = assetPath.Split(new[] {'\\', '/'});
if (pathNodes.Length > 1)
return string.Join("/", pathNodes.Take(pathNodes.Length - 1).ToArray()) + "/";
return string.Empty;
}
}
}
@@ -0,0 +1,17 @@
using System.Linq;
namespace MonoGame.Extended.Content
{
internal static class ContentTypeReaderHelper
{
public static string GetDirectory(string assetPath)
{
var pathNodes = assetPath.Split('\\', '/');
if (pathNodes.Length > 1)
return string.Join("/", pathNodes.Take(pathNodes.Length - 1).ToArray()) + "/";
return string.Empty;
}
}
}
@@ -9,6 +9,7 @@ namespace MonoGame.Extended.Maps.Tiled
{
protected override TiledMap Read(ContentReader reader, TiledMap existingInstance)
{
var assetDirectory = ContentTypeReaderHelper.GetDirectory(reader.AssetName);
var backgroundColor = reader.ReadColor();
var renderOrder = (TiledRenderOrder) Enum.Parse(typeof (TiledRenderOrder), reader.ReadString(), true);
var tiledMap = new TiledMap(
@@ -29,8 +30,8 @@ namespace MonoGame.Extended.Maps.Tiled
for (var i = 0; i < tilesetCount; i++)
{
var assetName = reader.ReadString();
var texture = reader.ContentManager.Load<Texture2D>(assetName);
var textureName = reader.ReadString();
var texture = reader.ContentManager.Load<Texture2D>(assetDirectory + textureName);
var tileset = tiledMap.CreateTileset(
texture: texture,
firstId: reader.ReadInt32(),
@@ -52,7 +53,7 @@ namespace MonoGame.Extended.Maps.Tiled
return tiledMap;
}
private void ReadCustomProperties(ContentReader reader, TiledProperties properties)
private static void ReadCustomProperties(ContentReader reader, TiledProperties properties)
{
var count = reader.ReadInt32();
@@ -63,8 +64,10 @@ namespace MonoGame.Extended.Maps.Tiled
private TiledLayer ReadLayer(ContentReader reader, TiledMap tiledMap)
{
var layerName = reader.ReadString();
// ReSharper disable UnusedVariable
var visible = reader.ReadBoolean();
var opacity = reader.ReadSingle();
// ReSharper restore UnusedVariable
var layerType = reader.ReadString();
if (layerType == "TileLayer")
@@ -40,6 +40,7 @@
<Compile Include="BitmapFonts\BitmapFontRegion.cs" />
<Compile Include="Content\ContentManagerExtensions.cs" />
<Compile Include="Camera2D.cs" />
<Compile Include="Content\ContentTypeReaderHelper.cs" />
<Compile Include="EventHandlerExtensions.cs" />
<Compile Include="IDraw.cs" />
<Compile Include="IMovable.cs" />
@@ -1,5 +1,6 @@
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics;
using MonoGame.Extended.Content;
namespace MonoGame.Extended.TextureAtlases
{
@@ -7,8 +8,9 @@ namespace MonoGame.Extended.TextureAtlases
{
protected override TextureAtlas Read(ContentReader reader, TextureAtlas existingInstance)
{
var assetDirectory = ContentTypeReaderHelper.GetDirectory(reader.AssetName);
var assetName = reader.ReadString();
var texture = reader.ContentManager.Load<Texture2D>(assetName);
var texture = reader.ContentManager.Load<Texture2D>(assetDirectory + assetName);
var atlas = new TextureAtlas(texture);
var regionCount = reader.ReadInt32();
-1
View File
@@ -1,7 +1,6 @@
using System;
using System.Collections.Generic;
using Microsoft.Xna.Framework;
using MonoGame.Extended.Shapes;
namespace Sandbox
{

Before

Width:  |  Height:  |  Size: 26 KiB

After

Width:  |  Height:  |  Size: 26 KiB

Before

Width:  |  Height:  |  Size: 39 KiB

After

Width:  |  Height:  |  Size: 39 KiB

Before

Width:  |  Height:  |  Size: 32 KiB

After

Width:  |  Height:  |  Size: 32 KiB

Before

Width:  |  Height:  |  Size: 38 KiB

After

Width:  |  Height:  |  Size: 38 KiB

Before

Width:  |  Height:  |  Size: 54 KiB

After

Width:  |  Height:  |  Size: 54 KiB

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 23 KiB

Before

Width:  |  Height:  |  Size: 118 KiB

After

Width:  |  Height:  |  Size: 118 KiB

+210 -127
View File
@@ -14,126 +14,6 @@
#---------------------------------- Content ---------------------------------#
#begin hills.png
/importer:TextureImporter
/processor:TextureProcessor
/processorParam:ColorKeyColor=255,0,255,255
/processorParam:ColorKeyEnabled=True
/processorParam:GenerateMipmaps=False
/processorParam:PremultiplyAlpha=True
/processorParam:ResizeToPowerOfTwo=False
/processorParam:TextureFormat=Color
/build:hills.png
#begin desert.tmx
/copy:desert.tmx
#begin tmw_desert_spacing.png
/importer:TextureImporter
/processor:TextureProcessor
/processorParam:ColorKeyColor=255,0,255,255
/processorParam:ColorKeyEnabled=True
/processorParam:GenerateMipmaps=False
/processorParam:PremultiplyAlpha=True
/processorParam:ResizeToPowerOfTwo=False
/processorParam:TextureFormat=Color
/build:tmw_desert_spacing.png
#begin free-tileset.png
/importer:TextureImporter
/processor:TextureProcessor
/processorParam:ColorKeyColor=255,0,255,255
/processorParam:ColorKeyEnabled=True
/processorParam:GenerateMipmaps=False
/processorParam:PremultiplyAlpha=True
/processorParam:ResizeToPowerOfTwo=False
/processorParam:TextureFormat=Color
/build:free-tileset.png
#begin level01.tmx
/importer:TiledMapImporter
/processor:TiledMapProcessor
/build:level01.tmx
#begin test-tileset.png
/importer:TextureImporter
/processor:TextureProcessor
/processorParam:ColorKeyColor=255,0,255,255
/processorParam:ColorKeyEnabled=True
/processorParam:GenerateMipmaps=False
/processorParam:PremultiplyAlpha=True
/processorParam:ResizeToPowerOfTwo=False
/processorParam:TextureFormat=Color
/build:test-tileset.png
#begin test-tileset-map1.tmx
/importer:TiledMapImporter
/processor:TiledMapProcessor
/build:test-tileset-map1.tmx
#begin stump.png
/importer:TextureImporter
/processor:TextureProcessor
/processorParam:ColorKeyColor=255,0,255,255
/processorParam:ColorKeyEnabled=True
/processorParam:GenerateMipmaps=False
/processorParam:PremultiplyAlpha=True
/processorParam:ResizeToPowerOfTwo=False
/processorParam:TextureFormat=Color
/build:stump.png
#begin test-tileset-left-down.tmx
/importer:TiledMapImporter
/processor:TiledMapProcessor
/build:test-tileset-left-down.tmx
#begin test-tileset-left-up.tmx
/importer:TiledMapImporter
/processor:TiledMapProcessor
/build:test-tileset-left-up.tmx
#begin test-tileset-right-down.tmx
/importer:TiledMapImporter
/processor:TiledMapProcessor
/build:test-tileset-right-down.tmx
#begin test-tileset-right-up.tmx
/importer:TiledMapImporter
/processor:TiledMapProcessor
/build:test-tileset-right-up.tmx
#begin test-tileset-atlas.json
/importer:TexturePackerJsonImporter
/processor:TexturePackerProcessor
/build:test-tileset-atlas.json
#begin fireball.png
/importer:TextureImporter
/processor:TextureProcessor
/processorParam:ColorKeyColor=255,0,255,255
/processorParam:ColorKeyEnabled=True
/processorParam:GenerateMipmaps=False
/processorParam:PremultiplyAlpha=True
/processorParam:ResizeToPowerOfTwo=False
/processorParam:TextureFormat=Color
/build:fireball.png
#begin zombie-atlas.json
/importer:TexturePackerJsonImporter
/processor:TexturePackerProcessor
/build:zombie-atlas.json
#begin zombie.png
/importer:TextureImporter
/processor:TextureProcessor
/processorParam:ColorKeyColor=255,0,255,255
/processorParam:ColorKeyEnabled=True
/processorParam:GenerateMipmaps=False
/processorParam:PremultiplyAlpha=True
/processorParam:ResizeToPowerOfTwo=False
/processorParam:TextureFormat=Color
/build:zombie.png
#begin Fonts/courier-new-32.fnt
/importer:BitmapFontImporter
/processor:BitmapFontProcessor
@@ -147,15 +27,11 @@
/processorParam:GenerateMipmaps=False
/processorParam:PremultiplyAlpha=True
/processorParam:ResizeToPowerOfTwo=False
/processorParam:MakeSquare=False
/processorParam:TextureFormat=Color
/build:Fonts/courier-new-32_0.png
#begin isometric.tmx
/importer:TiledMapImporter
/processor:TiledMapProcessor
/build:isometric.tmx
#begin isometric_tileset.png
#begin Backgrounds/hills.png
/importer:TextureImporter
/processor:TextureProcessor
/processorParam:ColorKeyColor=255,0,255,255
@@ -163,6 +39,213 @@
/processorParam:GenerateMipmaps=False
/processorParam:PremultiplyAlpha=True
/processorParam:ResizeToPowerOfTwo=False
/processorParam:MakeSquare=False
/processorParam:TextureFormat=Color
/build:isometric_tileset.png
/build:Backgrounds/hills.png
#begin Backgrounds/Hills_1.png
/importer:TextureImporter
/processor:TextureProcessor
/processorParam:ColorKeyColor=255,0,255,255
/processorParam:ColorKeyEnabled=True
/processorParam:GenerateMipmaps=False
/processorParam:PremultiplyAlpha=True
/processorParam:ResizeToPowerOfTwo=False
/processorParam:MakeSquare=False
/processorParam:TextureFormat=Color
/build:Backgrounds/Hills_1.png
#begin Backgrounds/Hills_2.png
/importer:TextureImporter
/processor:TextureProcessor
/processorParam:ColorKeyColor=255,0,255,255
/processorParam:ColorKeyEnabled=True
/processorParam:GenerateMipmaps=False
/processorParam:PremultiplyAlpha=True
/processorParam:ResizeToPowerOfTwo=False
/processorParam:MakeSquare=False
/processorParam:TextureFormat=Color
/build:Backgrounds/Hills_2.png
#begin Backgrounds/Hills_3.png
/importer:TextureImporter
/processor:TextureProcessor
/processorParam:ColorKeyColor=255,0,255,255
/processorParam:ColorKeyEnabled=True
/processorParam:GenerateMipmaps=False
/processorParam:PremultiplyAlpha=True
/processorParam:ResizeToPowerOfTwo=False
/processorParam:MakeSquare=False
/processorParam:TextureFormat=Color
/build:Backgrounds/Hills_3.png
#begin Backgrounds/Hills_4.png
/importer:TextureImporter
/processor:TextureProcessor
/processorParam:ColorKeyColor=255,0,255,255
/processorParam:ColorKeyEnabled=True
/processorParam:GenerateMipmaps=False
/processorParam:PremultiplyAlpha=True
/processorParam:ResizeToPowerOfTwo=False
/processorParam:MakeSquare=False
/processorParam:TextureFormat=Color
/build:Backgrounds/Hills_4.png
#begin Backgrounds/Hills_Couds.png
/importer:TextureImporter
/processor:TextureProcessor
/processorParam:ColorKeyColor=255,0,255,255
/processorParam:ColorKeyEnabled=True
/processorParam:GenerateMipmaps=False
/processorParam:PremultiplyAlpha=True
/processorParam:ResizeToPowerOfTwo=False
/processorParam:MakeSquare=False
/processorParam:TextureFormat=Color
/build:Backgrounds/Hills_Couds.png
#begin Backgrounds/Hills_Sky.png
/importer:TextureImporter
/processor:TextureProcessor
/processorParam:ColorKeyColor=255,0,255,255
/processorParam:ColorKeyEnabled=True
/processorParam:GenerateMipmaps=False
/processorParam:PremultiplyAlpha=True
/processorParam:ResizeToPowerOfTwo=False
/processorParam:MakeSquare=False
/processorParam:TextureFormat=Color
/build:Backgrounds/Hills_Sky.png
#begin Tilesets/free-tileset.json
/importer:TexturePackerJsonImporter
/processor:TexturePackerProcessor
/build:Tilesets/free-tileset.json
#begin Tilesets/free-tileset.png
/importer:TextureImporter
/processor:TextureProcessor
/processorParam:ColorKeyColor=255,0,255,255
/processorParam:ColorKeyEnabled=True
/processorParam:GenerateMipmaps=False
/processorParam:PremultiplyAlpha=True
/processorParam:ResizeToPowerOfTwo=False
/processorParam:MakeSquare=False
/processorParam:TextureFormat=Color
/build:Tilesets/free-tileset.png
#begin Tilesets/isometric.tmx
/importer:TiledMapImporter
/processor:TiledMapProcessor
/build:Tilesets/isometric.tmx
#begin Tilesets/isometric_tileset.png
/importer:TextureImporter
/processor:TextureProcessor
/processorParam:ColorKeyColor=255,0,255,255
/processorParam:ColorKeyEnabled=True
/processorParam:GenerateMipmaps=False
/processorParam:PremultiplyAlpha=True
/processorParam:ResizeToPowerOfTwo=False
/processorParam:MakeSquare=False
/processorParam:TextureFormat=Color
/build:Tilesets/isometric_tileset.png
#begin Tilesets/level01.tmx
/importer:TiledMapImporter
/processor:TiledMapProcessor
/build:Tilesets/level01.tmx
#begin Tilesets/test-tileset-atlas.json
/importer:TexturePackerJsonImporter
/processor:TexturePackerProcessor
/build:Tilesets/test-tileset-atlas.json
#begin Tilesets/test-tileset-left-down.tmx
/importer:TiledMapImporter
/processor:TiledMapProcessor
/build:Tilesets/test-tileset-left-down.tmx
#begin Tilesets/test-tileset-left-up.tmx
/importer:TiledMapImporter
/processor:TiledMapProcessor
/build:Tilesets/test-tileset-left-up.tmx
#begin Tilesets/test-tileset-map1.tmx
/importer:TiledMapImporter
/processor:TiledMapProcessor
/build:Tilesets/test-tileset-map1.tmx
#begin Tilesets/test-tileset-right-down.tmx
/importer:TiledMapImporter
/processor:TiledMapProcessor
/build:Tilesets/test-tileset-right-down.tmx
#begin Tilesets/test-tileset-right-up.tmx
/importer:TiledMapImporter
/processor:TiledMapProcessor
/build:Tilesets/test-tileset-right-up.tmx
#begin Tilesets/test-tileset.png
/importer:TextureImporter
/processor:TextureProcessor
/processorParam:ColorKeyColor=255,0,255,255
/processorParam:ColorKeyEnabled=True
/processorParam:GenerateMipmaps=False
/processorParam:PremultiplyAlpha=True
/processorParam:ResizeToPowerOfTwo=False
/processorParam:MakeSquare=False
/processorParam:TextureFormat=Color
/build:Tilesets/test-tileset.png
#begin Sprites/fireball.png
/importer:TextureImporter
/processor:TextureProcessor
/processorParam:ColorKeyColor=255,0,255,255
/processorParam:ColorKeyEnabled=True
/processorParam:GenerateMipmaps=False
/processorParam:PremultiplyAlpha=True
/processorParam:ResizeToPowerOfTwo=False
/processorParam:MakeSquare=False
/processorParam:TextureFormat=Color
/build:Sprites/fireball.png
#begin Sprites/shadedDark42.png
/importer:TextureImporter
/processor:TextureProcessor
/processorParam:ColorKeyColor=255,0,255,255
/processorParam:ColorKeyEnabled=True
/processorParam:GenerateMipmaps=False
/processorParam:PremultiplyAlpha=True
/processorParam:ResizeToPowerOfTwo=False
/processorParam:MakeSquare=False
/processorParam:TextureFormat=Color
/build:Sprites/shadedDark42.png
#begin Sprites/stump.png
/importer:TextureImporter
/processor:TextureProcessor
/processorParam:ColorKeyColor=255,0,255,255
/processorParam:ColorKeyEnabled=True
/processorParam:GenerateMipmaps=False
/processorParam:PremultiplyAlpha=True
/processorParam:ResizeToPowerOfTwo=False
/processorParam:MakeSquare=False
/processorParam:TextureFormat=Color
/build:Sprites/stump.png
#begin Sprites/zombie-atlas.json
/importer:TexturePackerJsonImporter
/processor:TexturePackerProcessor
/build:Sprites/zombie-atlas.json
#begin Sprites/zombie.png
/importer:TextureImporter
/processor:TextureProcessor
/processorParam:ColorKeyColor=255,0,255,255
/processorParam:ColorKeyEnabled=True
/processorParam:GenerateMipmaps=False
/processorParam:PremultiplyAlpha=True
/processorParam:ResizeToPowerOfTwo=False
/processorParam:MakeSquare=False
/processorParam:TextureFormat=Color
/build:Sprites/zombie.png

Before

Width:  |  Height:  |  Size: 87 KiB

After

Width:  |  Height:  |  Size: 87 KiB

Before

Width:  |  Height:  |  Size: 1001 B

After

Width:  |  Height:  |  Size: 1001 B

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 25 KiB

Before

Width:  |  Height:  |  Size: 391 KiB

After

Width:  |  Height:  |  Size: 391 KiB

Before

Width:  |  Height:  |  Size: 123 KiB

After

Width:  |  Height:  |  Size: 123 KiB

Before

Width:  |  Height:  |  Size: 4.5 KiB

After

Width:  |  Height:  |  Size: 4.5 KiB

@@ -4,7 +4,7 @@
<property name="awesome" value="42"/>
</properties>
<tileset firstgid="1" name="free-tileset" tilewidth="128" tileheight="128" spacing="2" margin="2">
<image source="free-tileset.png" width="652" height="783"/>
<image source="Tilesets/free-tileset.png" width="652" height="783"/>
<tile id="7">
<properties>
<property name="frog" value="dog"/>

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 3.1 KiB

-9
View File
@@ -1,9 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<map version="1.0" orientation="orthogonal" width="40" height="40" tilewidth="32" tileheight="32">
<tileset firstgid="1" source="C:/Program Files (x86)/Tiled/examples/desert.tsx"/>
<layer name="Ground" width="40" height="40">
<data encoding="base64" compression="zlib">
eJztmNkKwjAQRaN9cAPrAq5Yq3Xf6v9/nSM2VIbQJjEZR+nDwQZScrwztoORECLySBcIgZ7nc2y4KfyWDLx+Jb9nViNgDEwY+KioAXUgQN4+zpoCMwPmQAtoAx2CLFbA2oDEo9+hwG8DnIDtF/2K8ks086Tw2zH0uyMv7HcRr/6/EvvhnsPrsrxwX7rwU/0ODig/eV3mh3N1ld8eraWPaX6+64s9McesfrqcHfg1MpoifxcVEWjukyw+9AtFPl/I71pER3Of6j4bv7HI54s+MChhqLlPdZ/P3qMmFuo5h5NnTOhjM5tReN2yT51n5/v7J3F0vi46fk+ne7aX0i9l6If7mpufTX3f5wsqv9TAD2fJLT9VrTn7UeZnM5tR+v0LMQOHXwFnxe2/warGFRWf8QDjOLfP
</data>
</layer>
</map>
Binary file not shown.

Before

Width:  |  Height:  |  Size: 37 KiB

+25 -27
View File
@@ -53,37 +53,35 @@
</Reference>
</ItemGroup>
<ItemGroup>
<None Include="Content\desert.tmx" />
<None Include="Content\Fonts\courier-new-32.fnt" />
<None Include="Content\free-tileset.json" />
<None Include="Content\free-tileset.tps" />
<None Include="Content\isometric.tmx" />
<None Include="Content\level01.tmx" />
<None Include="Content\Tilesets\free-tileset.json" />
<None Include="Content\Tilesets\free-tileset.tps" />
<None Include="Content\Tilesets\isometric.tmx" />
<None Include="Content\Tilesets\level01.tmx" />
<None Include="Content\read-me.md" />
<Content Include="Content\fireball.png" />
<Content Include="Content\Sprites\fireball.png" />
<Content Include="Content\Fonts\courier-new-32_0.png" />
<Content Include="Content\free-tileset.png" />
<Content Include="Content\hills.png" />
<Content Include="Content\Hills_1.png" />
<Content Include="Content\Hills_2.png" />
<Content Include="Content\Hills_3.png" />
<Content Include="Content\Hills_4.png" />
<Content Include="Content\Hills_Couds.png" />
<Content Include="Content\Hills_Sky.png" />
<Content Include="Content\isometric_tileset.png" />
<Content Include="Content\shadedDark42.png" />
<Content Include="Content\stump.png" />
<Content Include="Content\test-tileset.png" />
<Content Include="Content\tmw_desert_spacing.png" />
<Content Include="Content\zombie.png" />
<Content Include="Content\Tilesets\free-tileset.png" />
<Content Include="Content\Backgrounds\hills.png" />
<Content Include="Content\Backgrounds\Hills_1.png" />
<Content Include="Content\Backgrounds\Hills_2.png" />
<Content Include="Content\Backgrounds\Hills_3.png" />
<Content Include="Content\Backgrounds\Hills_4.png" />
<Content Include="Content\Backgrounds\Hills_Couds.png" />
<Content Include="Content\Backgrounds\Hills_Sky.png" />
<Content Include="Content\Tilesets\isometric_tileset.png" />
<Content Include="Content\Sprites\shadedDark42.png" />
<Content Include="Content\Sprites\stump.png" />
<Content Include="Content\Tilesets\test-tileset.png" />
<Content Include="Content\Sprites\zombie.png" />
<Content Include="Icon.ico" />
<None Include="Content\test-tileset-atlas.json" />
<None Include="Content\test-tileset-left-down.tmx" />
<None Include="Content\test-tileset-left-up.tmx" />
<None Include="Content\test-tileset-map1.tmx" />
<None Include="Content\test-tileset-right-down.tmx" />
<None Include="Content\test-tileset-right-up.tmx" />
<None Include="Content\zombie-atlas.json" />
<None Include="Content\Tilesets\test-tileset-atlas.json" />
<None Include="Content\Tilesets\test-tileset-left-down.tmx" />
<None Include="Content\Tilesets\test-tileset-left-up.tmx" />
<None Include="Content\Tilesets\test-tileset-map1.tmx" />
<None Include="Content\Tilesets\test-tileset-right-down.tmx" />
<None Include="Content\Tilesets\test-tileset-right-up.tmx" />
<None Include="Content\Sprites\zombie-atlas.json" />
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
+3 -7
View File
@@ -60,7 +60,7 @@ namespace Sandbox
{
_spriteBatch = new SpriteBatch(GraphicsDevice);
_bitmapFont = Content.Load<BitmapFont>("Fonts/courier-new-32");
_tiledMap = Content.Load<TiledMap>("level01");
_tiledMap = Content.Load<TiledMap>("Tilesets/level01");
var collisionData = _tiledMap
.GetLayer<TiledTileLayer>("Tile Layer 1")
.Tiles
@@ -68,7 +68,7 @@ namespace Sandbox
.ToArray();
_collisionGrid = new CollisionGrid(collisionData, _tiledMap.Width, _tiledMap.Height, _tiledMap.TileWidth, _tiledMap.TileHeight);
var fireballTexture = Content.Load<Texture2D>("fireball");
var fireballTexture = Content.Load<Texture2D>("Sprites/fireball");
var spriteSheetAtlas = TextureAtlas.Create(fireballTexture, 512, 197);
_sprite = new Sprite(spriteSheetAtlas[0])
@@ -78,7 +78,7 @@ namespace Sandbox
};
_spriteAnimator = new SpriteAnimator(_sprite, spriteSheetAtlas, 15);
var zombieSheet = Content.Load<TextureAtlas>("zombie-atlas");
var zombieSheet = Content.Load<TextureAtlas>("Sprites/zombie-atlas");
_zombie = new Zombie(zombieSheet)
{
Position = new Vector2(300, 500)
@@ -124,10 +124,6 @@ namespace Sandbox
_zombie.Velocity += new Vector2(0, 600) * deltaSeconds;
_zombie.Position += _zombie.Velocity * deltaSeconds;
_zombie.Update(gameTime);
_camera.LookAt(_zombie.Position);