Getting Started. XNA Game Studio 4.0 To download XNA Game Studio 4.0 itself, go to XNA Game.

Slides:



Advertisements
Similar presentations
2000 Prentice Hall, Inc. All rights reserved. 1 Outline 3.1Introduction 3.2Game Loop Components 3.3How to Implement in C# 3.4Adding Image to XNA Project.
Advertisements

Sprites, User Input, and Collision COSC 315 Fall 2014 Bridget M. Blodgett.
Constructor and New Fields // Don't synch draw() with vertical retrace of monitor graphics.SynchronizeWithVerticalRetrace = false; IsFixedTimeStep = true;
Creating Games For Windows, Xbox 360, and Windows Phone 7 Ryan Plemons
11 Reaction Timer Game Session 8.1. Session Overview  Find out how an XNA program can measure the passage of time and trigger events at certain points.
Dan Waters, Academic Relations Manager, Microsoft.
COMPUTER PROGRAMMING 2 Chapter 7 Sound. Objectives Find out how to prepare sounds for inclusion in Microsoft XNA projects. Incorporate sounds into XNA.
1 of 5 This document is for informational purposes only. MICROSOFT MAKES NO WARRANTIES, EXPRESS OR IMPLIED, IN THIS DOCUMENT. © 2007 Microsoft Corporation.
© by Pearson Education, Inc. All Rights Reserved.
2D Graphics in XNA Game Studio Express (Modeling a Class in UML) Game Design Experience Professor Jim Whitehead February 5, 2008 Creative Commons Attribution.
Chapter 2: The Visual Studio.NET Development Environment Visual Basic.NET Programming: From Problem Analysis to Program Design.
3.2 Presentation Software End Show Creating slide shows including audio,video and digital images End Show.
Developing games and applications for Xbox 360 using XNA* *XNA is XNA’s Not Acronymed An Introduction by Peter Messenger Senior Developer at QMASTOR Newcastle.
I can haz gamez?. Bret Stateham Microsoft Developer Evangelist Blog:
CHAPTER 1 XNA Game Studio 4.0. Your First Project A computer game is not just a program—it is also lots of other bits and pieces that make playing the.
McGraw-Hill© 2007 The McGraw-Hill Companies, Inc. All rights reserved. 1-1.
11 Games and Content Session 4.1. Session Overview  Show how games are made up of program code and content  Find out about the content management system.
Display 480x800 QVGA 320x480 HVGA Capacitive touch 4 or more contact points Camera 5 mega pixels or more Dedicated camera button Hardware buttons.
Lecture 2 Managing Windows OS Introduction to.NET Framework C# & Microsoft Visual Studio.NET 2008.
Computer Science – Game DesignUC Santa Cruz CMPS 20: Game Design Experience January 14, 2010 Arnav Jhala.
NOTE: To change the image on this slide, select the picture and delete it. Then click the Pictures icon in the placeholder to insert your own image. WEB.
CHAPTER 4 Images XNA Game Studio 4.0. Objectives Find out how the Content Manager lets you add pictures to Microsoft XNA games. Discover how pictures.
Rob Miles Microsoft MVP University of Hull Fun Programming with Visual Studio.
Using QuickSilver to mock-up Web 3.0 Krzys Ostrowski.
IE 411/511: Visual Programming for Industrial Applications
Virtual techdays INDIA │ Nov 2010 Developing Office Biz Application using WPF on Windows 7 Sarang Datye │ Sr. Consultant, Microsoft Sridhar Poduri.
11 A First Game Program Session Session Overview  Begin the creation of an arcade game  Learn software design techniques that apply to any form.
Using Namepsaces  This section lists the namespaces that the application will be using frequently. Saves the programmer from specifying a fully qualified.
XNA 4.0 簡介 靜宜大學資工系 蔡奇偉 副教授 © 大綱 XNA 簡介 XNA Framework XNA Build XNA Game Studio 建立 XNA 4 的專案 方案的目錄結構 XNA Game Studio 4.0 參考手冊 Hello, XNA XNA Game.
Clearly Visual Basic: Programming with Visual Basic 2008 Chapter 4 I Need a Tour Guide.
Developing the Game User Interface (UI) Lesson 5.
1 Useful Tools for Making Video Games Part V An overview of.
NOTE: To change the image on this slide, select the picture and delete it. Then click the Pictures icon in the placeholder to insert your own image. WEB.
11 Adding Sounds Session 7.1. Session Overview  Find out how to capture and manipulate sound on a Windows PC  Show how sound is managed as an item of.
CHAPTER 10 Using C# Methods to Solve Problem XNA Game Studio 4.0.
11 Adding Tomato Targets Session Session Overview  We now have a game which lets a player bounce a piece of cheese on a bread bat  Now we have.
XNA An Introduction. What XNA is… Microsoft® XNA™ is composed of industry- leading software, services, resources, and communities focused on enabling.
XNA Game Studio 4.0 Keyboard and Mouse Controls + more on Animated Sprites.
11 Making a Sprite Session 4.2. Session Overview  Describe the principle of a game sprite, and see how to create a sprite in an XNA game  Learn more.
Rob Miles. How does an XNA game program work? Programs tell computers what to do A program is written in a programming language – C# is a programming.
Sprites, User Input, and Collision COSC 315 Fall 2014 Bridget M. Blodgett.
Aaron Yuen 1 Outline 9.1Storyboarding & Charting Method for Game Design 9.2Game State in Game Development 9.3Game State Management 9.4GUI Assets for Gameplay.
XNA Basic Displaying Image & Collision Detect. What’s format image that XNA support? XNA support only.bmp.png and.jpg image..PNG have transparent region.
CHAPTER 6 Multiplayer XNA Game Studio 4.0. Objectives Discover how to detect and use individual button-press events in a game. Learn how to create and.
CHAPTER 2 The Game Loop - Variables, Types, Classes and Objects in XNA XNA Game Studio 4.0.
11 Writing Text Session 5.1. Session Overview  Show how fonts are managed in computers  Discover the difference between bitmap fonts and vector fonts.
Playing with Sprites. XNA Game Lifecycle In the faceBall demo program we bounced a smiley face around the graphical display against a background image.
XNA ● Proprietary Microsoft framework ● C#. Interface.
11 Using the Keyboard in XNA Session 9.1. Session Overview  Discover more detail on how the XNA keyboard is implemented  Find out how to use arrays.
XNA Tutorial 1 For CS134 Lecture. Overview Some of the hard work has already been done for you. If you build and run your game now, the GraphicsDeviceManager.
Rob Miles. Using data in an XNA game program An XNA game program Draw and Update methods that are called to run the game Colours are held in XNA as four.
Creating New Forms Projects can appear more professional when using different windows for different types of information. Select Add Windows Form from.
XNA Sound Effects. float volume, pitch, pan; SoundEffect boing1; SoundEffect boing2; boing1 = Content.Load ("boing1"); boing2 = Content.Load ("boing2");
Rob Miles. Creating a Broken MoodLight An XNA game contains game data which is used by the Draw and Update methods – Update updates the game data – Draw.
Consumer Windows Phone Emulator Phone Emulator SamplesDocumentation GuidesCommunity Packaging and Verification Tools Windows Phone Dev Tools AppHub.
Building Windows Phone 7 Games and Applications Yes, yes! “Games and Applications” and not “Applications and Games” Content is under NDA – please do no.
CHAPTER 5 Text XNA Game Studio 4.0. Objectives Discover how text is drawn using Microsoft XNA. Add some font resources to your XNA program. Draw some.
XNA 4.0 Side Scrolling.
Lecture 4 Using SpriteFonts
Graphical Output Basic Images.
Using and Creating Sprites
MonoGame and Windows 8.
Collision Detection.
Animated Sprites.
Side Scrolling Game Development.
Lecture 2 - Building a Monogame Windows Project
MTA-4201 Game Programming Chapter 8 : Scrolling Background & Font
Collisions with Static Objects
Presentation transcript:

Getting Started

XNA Game Studio 4.0 To download XNA Game Studio 4.0 itself, go to XNA Game Studio 4.0 needs the Microsoft Visual Studio 2010 development environment, XNA Game Studio 4.0 works with any of the following Microsoft Visual Studio 2010 products. Microsoft Visual Studio 2010 Express for Windows Phone Microsoft Visual C# 2010 Express Edition Microsoft Visual Studio 2010 Standard Edition Microsoft Visual Studio 2010 Professional Edition XNA Game Studio requires the Microsoft.NET Framework 4.0. The setup program for Microsoft Windows Phone Developer Tools installs the.NET Framework if it is not installed already on your computer. You also can install the.NET Framework from the Microsoft.NET Framework Developer Center.

High Dynamic Range (HDR) Rendering vs Reach If you see this message when attempting to build an XNA game it probably means that your graphics card does not support High Dynamic Range (HDR) rendering. You will need to change the properties/settings of your project by right-clicking the game project name and changing the Game Profile...

Additional Required Software Installed by Setup The XNA Game Studio setup program also installs the following required software: XNA Game Studio setup installs the DirectX runtime, which is required to use the XNA Framework Game API. XNA Game Studio Setup installs multiple versions of the Microsoft Cross-platform Audio Creation Tool (XACT). XNA Game Studio Setup installs Microsoft Games for Windows – LIVE Redistributable, version This software provides support for various gamer services such as retrieving player preferences for local accounts, as well as programmatically displaying various LIVE Guide user interface screens.

Step 1: Select New Project, choose Visual C# from the Installed Templates list on the left and specify Windows Game (4.0). Give your project an appropriate name, such as FaceBall and then click OK. Creating your First XNA Program

Step 2: Test Run your program. You should see a new Windows Form appear with a light blue background (CornFlowerBlue). You should note that this window is not resizable. Before moving on, let's take a look at the automatically generated game code...

namespace FaceBall { public class faceBall : Microsoft.Xna.Framework.Game { GraphicsDeviceManager graphics; SpriteBatch spriteBatch; public faceBall() { graphics = new GraphicsDeviceManager(this); Content.RootDirectory = "Content"; } protected override void Initialize() { base.Initialize(); } protected override void LoadContent() { spriteBatch = new SpriteBatch(GraphicsDevice); } protected override void Update(GameTime gameTime) { if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed) this.Exit(); base.Update(gameTime); } protected override void Draw(GameTime gameTime) { GraphicsDevice.Clear(Color.CornflowerBlue); base.Draw(gameTime); } your game class inherits from the Microsoft.Xna.Framework.Game class Creates a new GraphicsDeviceManager and registers it to handle the configuration and management of the graphics device for the specified Game. Enables a group of sprites to be drawn using the same settings. Add your initialization logic here This method is called once at start of game and is where you should load your content. This is where you will update the state of your game. Update( ) is called once for each pass through the game loop. This is where you generate the display for the current frame. Draw( ) is called once for each pass through the game loop.

Step 3: Now you will associate "content" (such as sprite bitmaps) with your game project. Image, sound and other resources can be found in Resources (see Home Page). Download face.bmp and background.bmp and put them somewhere easy to find them such as on your desktop. Right-click FaceBallContent in Solution Explorer, choose Add Existing Item and then navigate to one of the bitmaps being added to content. Repeat for the other bitmap.

Step 4: FaceBall is a simple demo that bounces a smiley face around in the graphics display region of the game. The following code is inserted at the top of the class. Step 5: Add code to the Initialize( ) method to set the min and max limits of graphics viewport. Texture2D faceTexture; Texture2D backgroundTexture; Vector2 facePosition; public int maxX, minX, maxY, minY; public int faceVx = 5; public int faceVy = 2; Viewport view = graphics.GraphicsDevice.Viewport; base.Initialize(); maxX = view.Width; minX = 0; maxY = view.Height; minY = 0; facePosition.X = view.Width / 2; facePosition.Y = view.Height / 2;

Step 6: Add code to the LoadContent( ) method to load the face and background bitmaps. Step 7: Add code to the Update( ) method to keep the bouncing face inside the graphics viewport. faceTexture = Content.Load ("face"); backgroundTexture = Content.Load ("background"); facePosition.X += faceVx; if (facePosition.X > maxX - faceTexture.Width) faceVx *= -1; if (facePosition.X < minX) faceVx *= -1; facePosition.Y += faceVy; if (facePosition.Y > maxY - faceTexture.Height) faceVy *= -1; if (facePosition.Y < minY) faceVy *= -1;

Step 8: Add code to the Draw( ) method to draw the background and the face in the current position. spriteBatch.Begin(); spriteBatch.Draw(backgroundTexture, new Rectangle(minX,minY,maxX,maxY),Color.White); spriteBatch.Draw(faceTexture, facePosition, Color.White); spriteBatch.End(); Note that the default transparency color in XNA is magenta (255,0,255). The background image is automatically stretched to fit size of the rectangle specified.

namespace FaceBall { public class faceBall : Microsoft.Xna.Framework.Game { GraphicsDeviceManager graphics; SpriteBatch spriteBatch; public faceBall() { graphics = new GraphicsDeviceManager(this); Content.RootDirectory = "Content"; } protected override void Initialize() { base.Initialize(); } protected override void LoadContent() { spriteBatch = new SpriteBatch(GraphicsDevice); } protected override void Update(GameTime gameTime) { if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed) this.Exit(); base.Update(gameTime); } protected override void Draw(GameTime gameTime) { GraphicsDevice.Clear(Color.CornflowerBlue); base.Draw(gameTime); } Texture2D faceTexture; Texture2D backgroundTexture; Vector2 facePosition; public int maxX, minX, maxY, minY; public int faceVx = 5; public int faceVy = 2; Viewport view = graphics.GraphicsDevice.Viewport; maxX = view.Width; minX = 0; maxY = view.Height; minY = 0; facePosition.X = view.Width / 2; facePosition.Y = view.Height / 2; faceTexture = Content.Load ("face"); backgroundTexture = Content.Load ("background"); facePosition.X += faceVx; if (facePosition.X > maxX - faceTexture.Width) faceVx *= -1; if (facePosition.X < minX) faceVx *= -1; facePosition.Y += faceVy; if (facePosition.Y > maxY - faceTexture.Height) faceVy *= -1; if (facePosition.Y < minY) faceVy *= -1; spriteBatch.Begin(); spriteBatch.Draw(backgroundTexture, new Rectangle(minX, minY, maxX, maxY), Color.White); spriteBatch.Draw(faceTexture, facePosition, Color.White); spriteBatch.End(); FaceBall Code Summary

Step 9: Run the program to verify correct operation.