Hey guys here is a quick update on my platformer game. I've been able to add in some decent player physics, modeled after the Platformer Starter Kit on the Xna website. I've also spent most of my time on the editor lately, getting it up to speed with my engine and designing it in such a way that I will be able to create platformer games much quicker than just hard-coding in the levels for this one game.
Thanks for taking the time to check up on my game. I'm really looking forward to developing the engine and editor even more. One of the things I'm in the process of adding is a dedicated object layer for the maps. Right now, the only thing on that object layer (which is loaded in from a file by the way) is the player. Most likely, the next thing I will add to the layer is an exit tile, which will load up the next level (tile map in my case). This, I feel, will make the game start to feel more like an actual game than just a level demo.
Stay tuned for more updates!
Showing posts with label xna. Show all posts
Showing posts with label xna. Show all posts
Sunday, February 5, 2012
Xna Platformer Update
Labels:
2d,
C#,
demo,
game development,
platformer,
player,
tile engine,
tile map,
update,
xna,
XNA Game Studio
Thursday, January 5, 2012
Revisiting Nick's Tile Engine Series
Hello and welcome back to this revamped look at game development. The very first thing that I believe every old school rpg needs is a virtual world in which to exist. This world needs to be self-contained, but not flawless. The first iteration of this world need not have any bells or whistles and only needs to display (in my case) a map of tiles that make it look like an actual world.
This is where Nick Gravelyn's old Tile Engine Series comes into play. I'm going to be going through his tutorial series, modifying where needed to suite my own designs, at least in the first parts of my rpg. I'll try to comment where needed.
The first thing that we need in order to display our tiles is a list of textures for those tiles. We do this by loading in a list of textures:
These lines load individual texture images into a list of Texture2D textures. So far, we are following along with Nick's tutorial exactly.
After we have our list of textures we are free to create a map:
Using this map we only have to iterate through the 2D array of 1's and 0's to draw our map:
The code here sets the width of the tile map to the second dimension of the array, while the height is the first dimension. We then grab the number at each spot in the array and draw the corresponding image indexed to the value of the spot on the 'map' (array). For my map, tileWidth and tileHeight are set to 64.
This is a very basic way of drawing a map in Xna. There is much room for improvement/development and we will be taking our time getting the features of this game fleshed out in order to ensure that this game is fun to play and fun to develop. I appreciate you reading this and welcome any comments, suggestions, and questions gladly.
This is where Nick Gravelyn's old Tile Engine Series comes into play. I'm going to be going through his tutorial series, modifying where needed to suite my own designs, at least in the first parts of my rpg. I'll try to comment where needed.
The first thing that we need in order to display our tiles is a list of textures for those tiles. We do this by loading in a list of textures:
texture = Content.Load<Texture2D>("Tiles/grass1");
textureList.Add(texture);
texture = Content.Load<Texture2D>("Tiles/dirt1");
textureList.Add(texture);
These lines load individual texture images into a list of Texture2D textures. So far, we are following along with Nick's tutorial exactly.
After we have our list of textures we are free to create a map:
int [,] tileMap = new int[,]{
{0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 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, 1, 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, 1, 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, 1, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 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, 1, 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, 1, 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, 1, 0, 0, 0, 0, 0, 0},
};
Using this map we only have to iterate through the 2D array of 1's and 0's to draw our map:
int tileMapWidth = tileMap[1].GetLength();
int tileMapHeight = tileMap[0].GetLength();
for (int x = 0; x < tileMapWidth; x++) {
for (int y = 0; y < tileMapHeight; y++) {
int textureIndex = tileMap[y, x];
Texture2D texture = textureList[textureIndex];
spriteBatch.Draw(
texture,
new Rectangle(
x * tileWidth,
y * tileHeight,
tileWidth,
tileHeight),
Color.White);
}
}
The code here sets the width of the tile map to the second dimension of the array, while the height is the first dimension. We then grab the number at each spot in the array and draw the corresponding image indexed to the value of the spot on the 'map' (array). For my map, tileWidth and tileHeight are set to 64.
This is a very basic way of drawing a map in Xna. There is much room for improvement/development and we will be taking our time getting the features of this game fleshed out in order to ensure that this game is fun to play and fun to develop. I appreciate you reading this and welcome any comments, suggestions, and questions gladly.
Labels:
C#,
nick gravelyn,
rpg,
texture,
tile,
tile engine,
tile map,
tiles,
xna
Wednesday, December 28, 2011
A Fresh Start
Hello everyone! My sincerest apologies for being away for so long. I must admit that I had become burnt out at making games and wasn't spending enough time actually playing games. But now I am back and ready to get started on what I'm sure every aspiring game developer has thought of making at some point in their programming career, a classic RPG. My favorite types of rpgs are the 2D ones from the days of the Super Nintendo and the old 486 computers that some of you may not even remember. I am therefore going to shift gears with my blog to work on a classic 2D rpg in the style of FF2. I'm going to be taking you along for the ride and showing you and explaining to you what I'll be doing at each iteration of the game, much like I did with Prospectus. I'll be making this game using C#, Xna Game Studio, and Microsoft Visual Studio. I feel that Xna is a great way to take out many of the annoyances that come with trying to design the perfect game loop, or construct the best structure of a game, or ensure that the game updates and draws everything it is supposed to. This will allow me to focus more on the meat and potatoes of the game and leave the rest up to Xna.
I appreciate everyone who follows along with this blog and I again apologize for being away for so long. Here's to a successful venture into the world of rpgs!
I appreciate everyone who follows along with this blog and I again apologize for being away for so long. Here's to a successful venture into the world of rpgs!
Subscribe to:
Posts (Atom)
