Part 35 — Conversations Project. Part 36 — Animated Tiles Project. Part 37 — Map Editor Revisted Project. Powered by WordPress. AwesomeOne theme by Flythemes. Part 1 — Getting Stated. This first tutorial is about getting started with the role playing game, Eyes of the Dragon.
I create the basic project, two class libraries, and some components that will be used through out the rest of the tutorials. In the second tutorial I add in support for Xbox controllers to the input handler.
I also add in some GUI controls and a class to manage them. I add in another screen to the game and show how to move between game states. I also added in another game screen, the playing screen. I also filled out the starting menu screen. The forth tutorial is about adding in a tile engine for the game. The tile engine is what you will use to draw the maps the player will use to explore your world. In the next tutorial I will add in more to the tile engine.
I continued on with the tile engine in this tutorial. It includes adding in a 2D camera to control scrolling the map and having maps with multiple layers and multiple tile sets.
This tutorial covers adding a new control to be used with the control manager and adding in a screen for the player to create their character. In this tutorial I added in an animated sprite for the player to control. I also added two modes for the camera. In the one mode the camera follows the sprite and in the other the camera moves independently of the sprite. This adds in some basic classes for items in the game and a class to manage them. This adds in some basic classes for characters in the game and a class to represent the world the game takes place in.
In this tutorial I add in an editor for the game and move from a static character class system to a dynamic character class system. This is part one of a three part tutorial. In this second part of tutorial In this tutorial I continue on with adding in editors for the game.
In this third part of tutorial This tutorial upgrades a few things in the game. I expand on the World class and make the tile engine a little more efficient.
I cover adding in a List Box control and adding in a new screen to load games from. I also updated a couple screens to make it easier to load games and start new games. In this 2 part tutorial I do a little work on the editors and actual create some data that can be read into our game.
This tutorial covers adding in some basic classes that will be needed down the road for skills, spells, and talents.
This tutorial covers adding in some basic classes that will be needed down the road for conversations and quests. It also updates the game to use the classes from the past two tutorials.
This tutorial covers the basics of placing chests for the player to interact with. They are just being drawn at the moment but picking them up will come eventually. I also added in a couple place holder classes for traps. In this 2 part tutorial I do a little work on the the player being able to find loot.
Then once you are done, you can go through the process of upgrading the bits you are most interested in by using Visual Studio and XNA 4. That route will provide the least amount of headache, but does take the extra step at the end. However, if you have some things under your belt and don't mind redoing the code as you go along by using the cheat sheet, then you can just get Visual Studio and the source code and work through the cheat sheet.
My original plan was to update the book when XNA 5 would be released, but it doesn't appear that a new version will be released. So you can use Git and create a clone locally to start working with it or you can fork it and update it for XNA 4. This tutorial will describe the process where you create a selection wheel to be used with a Gamepad controller. This will allow you to create conversation wheels, power wheels, weapon wheels, command wheels, etc in your games.
Note this demo requires a Gamepad, so you will either need to have one hooked up to Windows or run this on the Xbox which requires an AppHub membership. I thought it was extremely clever the first time I saw it used in a game and I definitely enjoy games that utilize it.
From this wheel the player can select items which can either select that item or bring up new selections in the wheel. For example, if the user selected the health item at the bottom assuming it was enabled because the character was in combat then it would immediately apply the health potion to the character and the wheel would disappear. However, if the user selected the Potions selection on the left the items in the wheel would be replaced by the available potions the user had.
For Dragon Age, the gamer brings up this wheel by holding down the Left Trigger. This is a wheel that has a lot more options but the premise is the same.
Move the Gamepad controller around the edges to select the item. The gamer brings up this wheel by hitting the Right Bumper RB button. This also simply selects what is desired and closes the wheel.
In these images only three items on the right are available. When more conversation items are available they will show up on the left. The point here is that you can utilize the same input mechanics in a wide variety of games. It will show how to convert the X and Y values from the thumbstick to an angle and then utilize that angle to point to the different items in our wheel. The current item that is pointed to will be displayed beside the wheel.
The download at the bottom includes the actual wheel. NET file with the different layers. The actual content project will use two different files created from this original artwork. The first is the selection wheel itself selection. The second is the arrow selector. Note for the blog, these have white backgrounds but in the download they are transparent. So make sure you grab the files from there and not by saving these images. After creating the artwork I then started on the code which was much easier I must say.
A real artist would have had no problem lining up the inner circle to the outer circle but I struggled and still am not confident it is perfectly centered. I called mine SelectionWheel. Inside of the Content Project i. SelectionWheelContent add the artwork selection. Also add in a new SpriteFont called font. Open up the font xml file font. That is all of the content we need for this tutorial. Now we are going to add the integer values we will be selecting on the wheel.
Add the following constants to the class:. Next we need to create a member field to store the list of selections. In this case we are just storing strings of the selection, but this could be any kind of object you desire.
We will also add in a variable to store our radians and index of our selection. Inside of our Game1 constructor we can set the preferred backbuffer width and height if we want. Next we can actually load the content we created by adding the following code in the LoadContent method:.
We will save the Update method for the last since that is where the bulk of our work will be done. The selection is being drawn based on the current index selected initialized to 0. The selection wheel is drawn and the selector is drawn right on top of it. The selector is being rotated by the negative radians amount. The radians value will be populated in the Update method next.
It is being drawn offset so it will be in the center of the selection wheel and the origin of the selector was set to half of the texture size , so it would rotate around the middle. The selector image could be trimmed and these values modified to save some room but for this example I wanted to keep it clear as to how it is working. Now we get to the real part of the tutorial. Here comes the big complicated math to make this work. Next we need to calculate the index we are currently pointing to so the arrow.
First, we only want to change our radians value if the thumstick is off center. If it is centered, but the X and Y values will return 0. Assuming the stick is actually being pushed in a particular direction we want to determine the angle. The MathHelper. Atan2 method is extremely helpful. There is no need to write code for the trigonometry behind this calculation we can simply use it.
At this point we have our angle value in radians. You can totally just work with radians but most people myself included find it easier to work in degrees. For now, to get the angle in degrees we need to add the following code to our Update method:. Atan2 returns negative values for quadrant 3 and 4. So basically degrees comes out as to Atan2 returns values from -Pi to Pi to give you a full circle basically to 0 to instead of 0 to We check to see if our degrees value is less than 0 and if so we add to it.
This converts So we get a full 0 to Wow, it has been a really busy month for me. I haven't had much time to devote to tutorials but I have been working with XNA.
I finished an entry to a game programming challenge at Game Institute and it did win but noone else was able to finish their game in time.
It is pretty much finished. I'm just working on the documentation that goes with Xin and creating a demo program to go with Xin as well. I have just added the next tutorial in my XNA role playing game tutorial series to my web site! In this tutorial I continued on with the player being able to pick up items off the map. I created a new screen to display the contents of a chest. At the moment there is only gold in the chest but soon there will be the ability to be items as well.
I hope to have another tutorial in my XNA role playing game series finished in the very near future! Wednesday, February 10, Was pretty busy today. I spent most of this evening working on the new tutorial in my XNA role playing game tutorial series.
I was able to get all that I wanted to accomplish with code done tonight. I should have the writing finished tomorrow for sure.
What I have now is that when the player touches a chest a pop up appears letting the player know that they have found treasure and it lets them know that they have found a random amount of gold.
Placing actual items into the chests will be a little harder to accomplish. I will have to add a few classes to the game to handle inventory. I will also have to create the actual items that will go into the game. This is a rather complex process but I will take it one step at a time.
In case you are interested, this is a screen shot of what I have working now. Tuesday, February 9, 2 new XNA tutorials! Well, I added the two new XNA tutorials to my web site on the 9th. I say the 9th because by the time I'm done writing this entry it will probably be the 10th for me. I mentioned on my site, and probably here, that I had two tutorials on creating a screen management system with XNA to add to my screen manager tutorial series.
In the first tutorial I added in support for an Xbox controller, in the second tutorial I showed how to create a pop up screen. You can find the links to the tutorials on the XNA Tutorials page of my web site.
I plan to work on the next tutorial in my role playing game tutorial series and have that available soon as well. Good luck with your XNA game programming adventures. Saturday, February 6, More about Xin. I was working a little with Xin and I have found it to be very helpful.
Once I finish writing up some documentation for Xin I will be releasing it for anybody who would like to use it. I'm thinking of going with a create commons licence for using Xin.
0コメント