I recently started learning XNA and after getting annoyed with creating individuals rectangles each time I wanted to add something I went with TiledLib so I could more easily create levels using the Tiled map editor. My problem is, though, I have no idea how to check for collision using TiledLib. There is very little documentation on it and where people have solved the problem it seems like the code they provide is outdated.
For those who do not know TiledLib: https://bitbucket.org/nickgravelyn/tiledlib
I'm using mostly the code that comes in the demo (such as Map.cs/MapProcessor.cs) because I don't know too much how it works, but it does the job.
I've heard to detect for collision I should use a seperate layer that contains all the tiles I want to collide with, but aside from updating the map to accomdate that I don't know how to actually check for that in my code and make those tiles collide with things. Also, attempting to add a layer to my tile map and then running my game provides this error:
Error 1 Building content threw ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index at System.ThrowHelper.ThrowArgumentOutOfRangeException() at System.Collections.Generic.List`1.get_Item(Int32 index) at PlatformerContentPipeline.MapProcessor.Process(MapContent input, ContentProcessorContext context) in e:\Platformer\Platformer\PlatformerContentPipeline\MapProcessor.cs:line 94 at Microsoft.Xna.Framework.Content.Pipeline.ContentProcessor`2.Microsoft.Xna.Framework.Content.Pipeline.IContentProcessor.Process(Object input, ContentProcessorContext context) at Microsoft.Xna.Framework.Content.Pipeline.BuildCoordinator.BuildAssetWorker(BuildItem item) at Microsoft.Xna.Framework.Content.Pipeline.BuildCoordinator.BuildAsset(BuildItem item) at Microsoft.Xna.Framework.Content.Pipeline.BuildCoordinator.RunTheBuild() at Microsoft.Xna.Framework.Content.Pipeline.Tasks.BuildContent.RemoteProxy.RunTheBuild(BuildCoordinatorSettings settings, TimestampCache timestampCache, ITaskItem sourceAssets, String& outputContent, String& rebuiltContent, String& intermediates, Dictionary`2& dependencyTimestamps, KeyValuePair`2& warnings) e:\Platformer\Platformer\Platformer\PlatformerContent\level1.tmx Platformer
I'm at a loss at what to do. If anyone could help me with this, or perhaps let me know of a more updated and more well documented 2D engine for C#/XNA, that would be great.