XNA ● Proprietary Microsoft framework ● C#. Interface.

Slides:



Advertisements
Similar presentations
Games in Python – the easy way
Advertisements

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.
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
Video Game Design Lesson 1. Game Designer Person involved in the development of a video game Person involved in the development of a video game Usually.
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.
3.1. G RAPHICS I The use of images within games. Reflections and advice on the games proposed in the Week 2 Hand-in.
2D Graphics in XNA Game Studio Express (Modeling a Class in UML) Game Design Experience Professor Jim Whitehead February 5, 2008 Creative Commons Attribution.
AGD: 5. Game Arch.1 Objective o to discuss some of the main game architecture elements, rendering, and the game loop Animation and Games Development.
Week 1 - Friday.  What did we talk about last time?  C#  SharpDX.
2 What is pyGame? A set of Python modules to make it easier to write games. –home page: –documentation:
I can haz gamez?. Bret Stateham Microsoft Developer Evangelist Blog:
Computer Science – Game DesignUC Santa Cruz CMPS 20: Game Design Experience January 14, 2010 Arnav Jhala.
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.
Getting Started. XNA Game Studio 4.0 To download XNA Game Studio 4.0 itself, go to XNA Game.
Using Namepsaces  This section lists the namespaces that the application will be using frequently. Saves the programmer from specifying a fully qualified.
Week 2 - Wednesday CS361.
Developing the Game User Interface (UI) Lesson 5.
1 Useful Tools for Making Video Games Part V An overview of.
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.
Microsoft Tech Days 2012 Cheezia: Developing a Windows Phone XNA Game Rodrigo Barretto Software Engineer - MCPD on Windows Phone
User Input and Collisions COSC 315 Fall 2014 Bridget M. Blodgett.
Addison Wesley is an imprint of © 2010 Pearson Addison-Wesley. All rights reserved. Chapter 7 The Game Loop and Animation Starting Out with Games & Graphics.
11 Using the Keyboard Session Session Overview  Introduce the keyboard device  Show how keys on a keyboard can be represented by enumerated types.
Introduction to XNA Graphics Programming Asst. Prof. Rujchai Ung-arunyawee COE, KKU.
Animate picture to peek from bottom (1 of 3) 1. Right click on picture you want to animate. 2. Click on Custom Animation. 2 1 R.
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.
Object Oriented Design COSC 315 Fall 2014 Bridget M. Blodgett.
XNA Game Studio 4.0 Keyboard and Mouse Controls + more on Animated Sprites.
MAEK GAEM III: SDL ● Simple DirectMedia Layer ● Input/Graphics/Audio using OpenGL ● Not nearly as difficult as OpenGL ● Cross Platform and Open Sauce ●
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.
Game Maker Terminology
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.
“The perfect project plan is possible if one first documents a list of all the unknowns.” Bill Langley.
Sprites, User Input, and Collision COSC 315 Fall 2014 Bridget M. Blodgett.
Game Creation in XNA CS470 Final Project Chris Ragland.
3D Models and Meshes Asst. Prof. Rujchai Ung-arunyawee COE, KKU.
CHAPTER 3 Getting Player Input XNA Game Studio 4.0.
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.
Lesson 3: Arrays and Loops. Arrays Arrays are like collections of variables Picture mailboxes all lined up in a row, or storage holes in a shelf – You.
1 Word Lesson 4 Working with Graphics Microsoft Office 2010 Introductory Pasewark & Pasewark.
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.
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.
Adobe Photoshop CS4 – Illustrated Unit A: Getting Started with Photoshop CS4.
Consumer Windows Phone Emulator Phone Emulator SamplesDocumentation GuidesCommunity Packaging and Verification Tools Windows Phone Dev Tools AppHub.
Enhancing JavaScript Using Application Programming Interfaces (APIs), Lecture #3.
2D Graphics CMT3311. This covers... How to make a transparent sprite How to add a sprite to your project and draw it Properties of sprites and how to.
Game Maker Tutorials Introduction Clickball IntroductionClickball Where is it? Shooting Where is it?Shooting.
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.
Sound and more Animations
XNA 4.0 Side Scrolling.
Graphical Output Basic Images.
Week 2 - Monday CS361.
Using and Creating Sprites
PYGAME.
WITH PYGAME ON THE RASPBERRY PI
An Introduction to Spritesheet Animation
Collision Detection.
Animated Sprites.
Game Loop Update & Draw.
Chapter 7 The Game Loop and Animation
Collisions with Static Objects
Presentation transcript:

XNA ● Proprietary Microsoft framework ● C#

Interface

Adding Content

Game1.cs ● Shit's already been written for you! ● Initialize() ● LoadContent() ● UnloadContent() ● Update() ● Draw()

The Game Loop

Initialize ● Initialize graphics device, set up resolution ● GraphicsDeviceManager ● Init() of all your game elements

LoadContent ● XNA uses Texture2D to store picture files ● ContentManager class allows you to load Texture2Ds from the ContentProj ● Content.Load (“mydumbfile”); ● (Type goes inside angle brackets)

Rectangle ● Draw method requires either a rectangle or vector2 ● Rectangle rect = new Rectanlge(x,y,w,h); ● Use it to keep track of object positions, or collision boundaries

Update ● Runs every frame, put game logic in here. ● HINT: Have some kind of game management class with it's own update method, which in turn updates all of your game objects. ● Get player input, do something with it.

Input ● KeyboardState, MouseState, GamepadState ● Keyboard.GetState(), etc.. ● MyMouse = Mouse.GetState(); ● Keys is an enum that contains all keys if(myKeyboard.IsKeyDown(Keys.Right)) { myRect.x += 5; }

Input Tip ● KeyBoardState only keeps track of whether or not a key is down. So what if you want to know if a key has JUST been pressed? (IE: Player jumps when you press Space Bar) ● Have a keyState var and oldKeyState. At the end of the Update loop, set oldKeyState to the current keyState. ● During update, if current keyState button is pressed, and oldKeyState is released, then the condition is met

Draw -SpriteBatch ● SpriteBatch handles all rendering. One has already been Initialized in Game1.cs ● spriteBatch.Begin(); ● //DRAW STUFF HERE ● spriteBatch.End();

Draw ● SpriteBatch.Draw() has a fuck ton of overloads ● Here's an easy one: ● Draw(Texture2D, Rectangle, Color) ● Color is an enum. Just do Color.White for now (you can instantiate a new Color(r,g,b,a) ● Other overloads include scaling, rotation, and source/destination rects

SpriteSheets

● Destination Rect determines where the obj will be drawn on screen ● Source Rect determines what portion of the source image will be drawn ● Animation can be achieved by drawing different portions of the source image in rapid succession.

● Rows = 4; ● Cols = 4; ● Lets say you want to draw frame 6. ● Int w = texture.Width / rows ● Int h = texture.Height / cols ● Int x = (currentFrame % rows) * width; ● Int y = (currentFrame % cols) * height; ● Rectangle source = new Rectangle(x,y,w,h);

Sound ● Usually the last thing anyone gets to ● Load a SoundEffect or a Song through the ContentManager class. ● Use mySound.Play() or MediaPlayer.Play(song) ● It's just that easy!

Collision Detection ● There are a number of ways to do collision detection, but bounding boxes is the easiest. ● myStupidRectangle.Instersects(fucktangle)