Archive for the ‘Microsoft’ Tag
Finished work on the GameWindow class, so I’ve been implementing a few items that would take advantage of this window class, mainly the Menu system!
As seen from the above screenshot, once you hit the “Menu” button on the controller, this screen pops up. From here you have access to a variety of options including ways to customize the look of the system, your inventory, and your Equipment. The system structure is in place and needs tweaking for sure, but at least the groundwork is done.
As always, below is a video of the progress. Just a few more systems and a demo will be released, exciting huh! Thanks to everyone who gave me some opinions on the menu system. As always, if you have any questions, feel free to send an email my way to CraigGiles9@yahoo.com
Video of the menu system in action
With the Map class complete, we can no start working extra things into our Tile Engine to display each map to screen. In its current state, the tile engine is incomplete for a few reasons including collision detection between characters and drawing order of all layers. However, i do have enough to get the basics of the engine up and running and continue to work on the rest of the systems of the game. So, on that note, lets begin!
I have 6 seperate regions to help organize the tile engine;
TileEngine Data – Houses all data associated with the engine. 3 data fields and properties; a true / false statement on if we’re loading a new map into memory, a Map file, and the mouse location for the editor.
Constructor(s) – initializes the tile engine on startup
private void Initialize()
map = new Map();
Update / Draw – … can you guess?
Update right now does nothing, but will call the “CheckCollisions();” method.
Draw just calls “map.Draw()” … so thats very easy.
Clamp Camera – Aah this is a fun one. I’ll post the code and see if you can make heads or tails of it.
public void ClampCameraToBoundries(Vector2 position)
//clamps the camera to the players position
Globals.Camera.Position.X = position.X – (Globals.Graphics.GraphicsDevice.Viewport.Width / 2);
Globals.Camera.Position.Y = position.Y – (Globals.Graphics.GraphicsDevice.Viewport.Height / 2);
//Clamps the camera within the game screen
Globals.Camera.Position.X = MathHelper.Clamp(Globals.Camera.Position.X, 0, (map.Width * map.TileWidth) – Globals.Graphics.GraphicsDevice.Viewport.Width);
Globals.Camera.Position.Y = MathHelper.Clamp(Globals.Camera.Position.Y, 0, (map.Height * map.TileHeight) – Globals.Graphics.GraphicsDevice.Viewport.Height);
Make sense? Basically you give the method the players current positional vector and it keeps the player within the center of the screen. If the player moves right, the camera moves right. If the player moves left, the camera left. However, after that it keeps the camera on top of the game world so if the player moves left to the edge of the map, the camera will stop when it reaches the imaginary edge.
Player Movement – This region does 4 things and is quite long compared to the camera clamping method. It will take the keyboard data collected by the games Update() method to determine if the player should be moving, and which direction. It then takes the positional vector of the player, and the speed modifier of the player, and calculates what the new position will be. Finally, it will take that new position, check to see if the player is on a tile it can walk on, and if so passes the new position to the game for update. If the player is on a tile they shouldn’t be on, it passes the old position, in essence, the player has not moved. Confusing huh? It can be.
Save / Load / Create New Map – map editor functions, and these are quite long and deal with loading and saving from an XML file from within the content pipeline. I do not write my own content importers or processors, so I’ve been using the System.XML namespace. If you want to know how its done, inquire within!
I tend to organize my programs by clumping things together. I know some people do “Data fields” “properties” “Constructor(s)” “Public Methods” “Private methods” but in bigger programs I’ve gotten into the habit of clumping everything together that goes with eachother. Might be a bad habit but to each his own. I’ve spent a few days on other systems for the Tile Engine and I’ve updated the code at the projects site. Next update I’ve had a request to post about my particle effects system, so I’ll get that in order and have it out here in a few days. I also will go into my in-game map editor.
As always, if you’re interested in checking out the full source code (newly updated), just head on over to code.google.com;
Taking a break from the terrain and 3D programming, I decided to take another look at my star field and design a particle effects system that can be used for 2D games. The dynamic sky background used in the space ship game was a good start, so I went to work and created a particle class, ParticleEffects class, and an effects manager class with the sole intention of having things go… BOOM!
With the current system, I’ve only designed a basic “firework” effect, but using the same logic I am attempting to create a system that can do a wide range of 2d effects, from basic cloud cover, smoke, fire, explosions, stars in the night sky, even rain.
I’ll be working on it a lot in the next little bit until trying to get the class usable in a variety of 2D programs, but for now… enjoy the boom!