Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
XNA 4.0 Game Development by Example: Beginner's Guide - Visual Basic Edition

You're reading from   XNA 4.0 Game Development by Example: Beginner's Guide - Visual Basic Edition Create your own exciting games with Visual Basic and Microsoft XNA 4.0

Arrow left icon
Product type Paperback
Published in Dec 2011
Publisher Packt
ISBN-13 9781849692403
Length 424 pages
Edition 1st Edition
Arrow right icon
Author (1):
Arrow left icon
Kurt Jaegers Kurt Jaegers
Author Profile Icon Kurt Jaegers
Kurt Jaegers
Arrow right icon
View More author details
Toc

Table of Contents (16) Chapters Close

XNA 4.0 Game Development by Example – Visual Basic Edition Beginner's Guide
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
1. Introducing XNA Game Studio FREE CHAPTER 2. Flood Control – Underwater Puzzling 3. Flood Control – Smoothing Out the Rough Edges 4. Asteroid Belt Assault – Lost in Space 5. Asteroid Belt Assault – Special Effects 6. Robot Rampage – Multi-Axis Mayhem 7. Robot Rampage – Lots and Lots of Bullets 8. Gemstone Hunter - Put on your Platform Shoes 9. Gemstone Hunter—Standing on your Own Two Pixels Index

Preface

The Microsoft XNA Framework provides a powerful set of tools to allow development teams of any size, from the individual developer to larger independent teams, to rapidly develop high-performance quality games for multiple Microsoft-related platforms.

This book will present a series of video games, utilizing Visual Basic and the XNA Framework, to delve into the world of 2D game development, targeting the Microsoft Windows environment. We will utilize XNA's 2D graphics capabilities to present our games to the player, and we will also look at the fundamental systems behind several game design challenges, such as pathfinding, collision detection, special effects, and more.

Each of the four games in this book cover a new gaming style and introduce progressively more advanced techniques and systems to provide a foundation for bringing your own creations to life.

What this book covers

Chapter 1, Introducing XNA Game Studio, begins by looking at the history of the XNA Framework and its predecessors and installing the Windows Phone SDK package that includes the version 4.0 release of the XNA tools. We wrap up this chapter by looking at the building blocks of an XNA game and putting together an XNA mini-game called SquareChase.

Chapter 2, Flood Control – Underwater Puzzling, introduces a board-based puzzle game called Flood Control. We introduce the XNA Content Pipeline and build a recursive function to determine the state of the game board while playing.

Chapter 3, Flood Control – Smoothing Out the Rough Edges, refines and completes the Flood Control game, adding animated rotation, movement, and fading of game pieces. We will implement a scoring system and cover displaying text to the screen.

Chapter 4, Asteroid Belt Assault – Lost in Space, begins by developing our second game. This time we put together a space-based shooter. We will create a basic moving star field, using a simple particle system, and introduce frame-based sprite animation. We will add moving asteroids to our star field and examine how to detect collisions between asteroids and make them respond realistically. We add a player-controlled spaceship and enemies that can fly across the screen following pre-defined waypoints.

Chapter 5, Asteroid Belt Assault – Special Effects, wraps up Asteroid Belt Assault. We implement collision detection between the player, enemies, asteroids, and bullets, and create particle-based explosions. Finally, we will look at loading and playing sound effects to bring life to our in-game events.

Chapter 6, Robot Rampage – Multi-Axis Mayhem, begins the construction of a tank-based game in which the player can move and fire independently using either an Xbox 360 controller or the keyboard. We build a tile-map-based game world and a camera class to view a screen-sized area of the larger world, and we implement player collision with the walls of the tile map.

Chapter 7, Robot Rampage—Lots and Lots of Bullets, completes Robot Rampage by expanding on our particle-based explosion system and adding enemies, player goals, and weapon upgrades to our tile map. We allow the player to fire at the enemies with several different weapons. Finally, we create an implementation of the A* pathfinding algorithm to allow the enemy tanks to track down the player.

Chapter 8, Gemstone Hunter - Put on Your Platform Shoes, introduces a side-scrolling, jump-and-run platform game. We start by evolving our tile-based mapping system to allow multiple layers of tiles, and we look at combining XNA and Windows Forms to produce a map editor for Gemstone Hunter. As part of this process, we will look at building more complex solutions that contain multiple projects, and we separate our game's tile engine into a Game Library project.

Chapter 9, Gemstone Hunter—Standing on your Own Two Pixels, concludes the Gemstone Hunter project by examining an alternative method for frame-based sprite animation, using player and enemy graphics from the XNA Platform Starter Kit. We implement platform physics and bring the game together by loading levels and reacting to their embedded code values.

What you need for this book

In order to install and use the Microsoft XNA 4.0 tools, you will need a Windows PC with either Microsoft Windows Vista or Microsoft Windows 7 and a video card supporting DirectX 9 or later. Shader Model 1.1 is required for XNA, but it is highly recommended that your video card support Shader Model 2.0 or later, as many of the XNA samples available online require 2.0 support.

Who this book is for

If you are an aspiring game developer who wants to take a shot at creating games for the Microsoft Windows platform with the XNA Framework, then this book is for you. Using this book, you can get started with creating games without any game development experience. Some knowledge of Visual Basic would be helpful to kick-start your game development experience.

Conventions

In this book, you will find several headings appearing frequently.

To give clear instructions of how to complete a procedure or task, we use:

Time for action – heading

  1. Action 1

  2. Action 2

  3. Action 3

Instructions often need some extra explanation so that they make sense, so they are followed with:

What just happened?

This heading explains the working of tasks or instructions that you have just completed.

You will also find some other learning aids in the book, including:

Pop quiz – heading

These are short multiple choice questions intended to help you test your own understanding.

Have a go hero – heading

These set practical challenges and give you ideas for experimenting with what you have learned.

You will also find a number of styles of text that distinguish between different kinds of information. Here are some examples of these styles and an explanation of their meaning.

Code words in text are shown as follows: "We can include other contexts through the use of the include directive."

A block of code is set as follows:

Public ReadOnly Property RotationAmount As Single
    Get
        If Clockwise Then
            Return _rotationAmount
        Else
            Return (MathHelper.Pi * 2) - _rotationAmount
        End If
    End Get
End Property

When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:

Public ReadOnly Property RotationAmount As Single
    Get
        If Clockwise Then
            Return _rotationAmount
        Else
            Return (MathHelper.Pi * 2) - _rotationAmount
        End If
    End Get
End Property

Any command-line input or output is written as follows:

#Region "Shot Management Methods"

New terms and important words are shown in bold. Words that you see on the screen, in menus or dialog boxes for example, appear in the text like this: "Click on the Register. Now link to go to the Visual Studio Express registration page".

Note

Warnings or important notes appear in a box like this.

Tip

Tips and tricks appear like this.

Reader feedback

Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or may have disliked. Reader feedback is important for us to develop titles that you really get the most out of.

To send us general feedback, simply send an e-mail to and mention the book title via the subject of your message.

If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide on www.packtpub.com/authors.

Customer support

Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.

Downloading the example code and colored images

You can download the example code files and the colored images for all Packt books you have purchased from your account at http://www.PacktPub.com. If you purchased this book elsewhere, you can visit http://www.PacktPub.com/support and register to have the files e-mailed directly to you.

Errata

Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in the text or the code—we would be grateful if you would report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/support, selecting your book, clicking on the errata submission form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded on our website, or added to any list of existing errata, under the Errata section of that title. Any existing errata can be viewed by selecting your title from http://www.packtpub.com/support.

Piracy

Piracy of copyright material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works, in any form, on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.

Please contact us at with a link to the suspected pirated material.

We appreciate your help in protecting our authors and our ability to bring you valuable content.

Questions

You can contact us at if you are having a problem with any aspect of the book, and we will do our best to address it.

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image