Fully functionable solution that has MyLevel.cs that can import Gleed2d level. Tile.cs that can create rectangle body and PathTile.cs that creates a path from gleed information. It also has an animated player character to show how the
level physics work. Character can run and jump using arrow keys and spacebar, respectively. Character has some problem with movement: when you jump or drop down it begins to stutter like a car with broken wheels.
The character was made with
code. The original character code works fine but when I added it to my solution, something went wrong. But it actually isn't the most important thing of this project.
Some things you have to remember:
This project comes with a leveltest.gleed level, that might or might not work out of the box, if not, then you should make a new one with Gleed2d and add it to project.
Gleed2d saves the texture paths like "content/something/image.jpg" and as you know, passing this to content.load() methods doesn't work. That's why in MyLevel.cs LoadTiles() I made a workaround and used Path.GetFileNameWithoutExtension(pathname)
to get rid of all the pathnames and get just "image". Then manually added "Tiles/" + "image".
There are two layers: Collision and Textures. Collision layer is used to create rectangles and paths that are collidable but invisible. Textures layer is just full of textures that are positioned just into same place as respective collision shape. Using these
two together you get functional level.
When adding new gleed levels to Content folder, remember to set from properties NOT to compile the file.