Josh-CO Dev

Solving the worlds problems one line of code at a time.

Leave a comment

Basic Tile Engine Tutorial – Creating our player class

If you haven’t completed the previous tutorial yet, be sure you do so. You can find it here. Also, if you want to download the code for all the way through this tutorial, you can find it here.

In this tutorial, we finally get around to the fun stuff and get the base for an actual working game. This tutorial will cover adding our player class, animating the player, etc.

First, create a new folder in your content project and name it peeps. You can really name it whatever you want, but the code I have written points to “peeps”. Download the below image and place it in the peeps folder.

Now that we have our sprite sheet, let’s start the tutorial.

Continue reading

Leave a comment

Basic Tile Engine Tutorial – Creating our tile class

Since I originally wrote this article, I have rolled up a new XNA solution that contains only a simple screen management solution and this class. You can find it here.

This tutorial series will follow all of the major steps needed to make a platform type of tile engine. I apologize that I am rusty on my XNA, all of this code is being pulled from projects that I have not worked on in several months. In many places, the code can be improved, which we will do a little bit of in future tutorials (we will convert this engine into more of an RPG type of tile engine). We will not go through all of the exact steps required to build the project, but will cover the major pieces. When finished, you should be able to write a game similar to the image below. I apologize if some of my explanations are not clear as I am not currently coding in XNA, but I will try to explain the code the best that I can.

-The first thing we need to do is create a new class. If you have never added a new class in visual studio before, right click on your project name or a specific folder and choose “add” and then “class.” Name this class TileSprite.cs.

-Include the usual stuff in your namespace section.

using System;
using System.Collections.Generic;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Content;
using System.Xml;
using System.IO;

-Add the following properties:
Continue reading