Josh-CO Dev

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

Leave a comment

XNA – Add bullets to our overhead game

This tutorial is a continuation from . If you have not yet completed this tutorial, you will need to follow it before following this one as we further use our custom classes. If you are just here to learn about shooting bullets, then you do not need the previous tutorial.

Before we can start this tutorial, we need a bullet. Here is a cheesy one you can download or you can create your own. For the sake of this tutorial, just make sure it is a 16×16 image unless you are comfortable enough modifying this code.
Continue reading

Leave a comment

XNA – Let’s break down our simple overhead game and start making classes

This is a continuation from . If you have not yet followed this tutorial, it might be a good time to check it out.

Our old code was simple and worked, so why split it out into classes? Well, mostly because it makes the code easier to work with as we add more code and expand the game. For example, what if we make the game two players? You’d have to create another texture, a second block of draw statements, a second block of update statements, etc. Or when we start to fire bullets. We don’t want to have to create X number of bullets in our constructor, show and hide them, track each one, etc. Classes allow us to easily move the code over to manageable classes that can be re-used.

Let’s start by creating a new class in our projet named sprite.cs. This class will hold our information that will be common across all sprites.
Let’s add our normal using statement.

using System;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;

Continue reading

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

1 Comment

XNA – Simple Screen Management

I’ve spent a lot of time searching around for screen management solutions and have found that almost everyone points you to Microsoft’s solution. Personally, I always felt that Microsoft’s was overkill for the average programmer and a lot more than most people need. I would also argue that most people who implement it probably don’t even understand what it is doing. A while back I ran into a blog post that proposed a simple way to do handle screen management here. I’ve used this code in several projects and it has always worked great and without fail, be sure you check it out!


Basic Tile Engine Tutorial – Creating our player class base

Update As with the other tutorials. I have whipped up a new solution for everything that we have covered so far and placed it here. Please feel free to download and have a working demo. I have also cleaned up the code a bit from the tutorial. Going forward, I will try to invest the time needed to clean up the code as I write the tutorials.

This is the third tutorial in our tile engine series. This tutorial will cover starting our player class to make our game playable! Please be sure that you have followed the previous tutorial located here first. This is probably the one component that if I had to do everything over again, I would have done it different. Revisiting this, I likely would have implemented a physics engine such as farseer.

-Start by adding a new class to your project and name it animatedSprite.
-As usual, add all the xna namespaces
Continue reading