I'm currently building a 2D platformer using Monogame and I'm having a bit of an issue. The way I have designed my game is that I use an array
to draw out the map of tiles, which all have collision, like this:
protected override void LoadContent()
{
map.Generate(new int[,] {
// 0 = no tile drawn
// 3 = tile is drawn
{0,0,0,0,0,0,0,0,0,0,},
{0,0,0,0,0,0,0,0,0,0,},
{0,0,0,0,0,0,0,0,0,0,},
{0,0,0,0,0,0,0,0,0,0,},
{3,3,3,3,3,3,3,3,3,3,},
{3,3,3,3,3,3,3,3,3,3,},
}, 57); // size
}
However I'm trying to think of a way that allows me to load another array that of course would have tiles placed differently once the player reaches a certain point, for example, using the array in my question, if the player spawns on the left and reaches the last tile on the right.
What would be the simplest way of trying to accomplish this?
Here's a good reference, supplied by Microsoft. This will allow you to examine and breakdown a working version of a 2D platformer.
https://msdn.microsoft.com/en-us/library/dd254916%28v=xnagamestudio.31%29.aspx
In brief, this is what I would expect to implement, regarding a 2D platformer and several levels (not scrolling).
The above data could be generated as a binary file and loaded in at start-up, or for ease created as an array of screne block data within your game class.
I'm sure the tutorial I've linked will guide you in the development of your game.