1. Open XNA Game Studio 4.0 or Visual Studio and begin a new VB Windows game project.
2. Add a graphic, called a sprite, for your computer to draw on the screen. Pick a classic hero character, such as an alien or a cartoon person and upload it in .jpg or .bmp format. Add the file to Visual Studio's Content file by right-clicking on it and selecting 'Add' and then 'Existing Item' from the menus that appear. Repeat this process to add two or three enemies that you will program to kill the character.
3. Add a timer to the game, and create a method called 'Tick()' and set it to fire every 30 milliseconds. If you're using XNA, you might prefer to use the 'GameTime' class.
4. Create a method called 'GameProcess' that responds to keystrokes and subscribe it to the 'tick' event so that it executes every 30 milliseconds. Detect each keystroke and analyze the event parameter to detect the precise keystroke entered by the user. Within the method, use a switch statement that will move the sprite up if the user presses the up key, down if he presses the down key and so on for the other directional keys. With each keystroke, record and alter the position of the sprite.
5. Add enemy movements to the 'tick' event within the 'GameProcess' function. Move the enemy pictures randomly using an instance of the 'Random' class. Each time an enemy moves, record its position and see if its position mirrors the position of the hero character. If the enemy and hero character are in identical positions, run a 'KillCharacter()' method that positions the characters at their starting points.
6. Give the hero three lives. Each time the 'KillCharacter()' method executes, subtract a life. End the game when the integer representing the hero's lives reaches zero.
Read more ►