XNA-in-a-Day

1,335 views

Published on

Slides presented at XNA-in-a-Day events. It walks through the creation of an XNA Windows game. Download the files at http://bit.ly/XNADayFiles.

Published in: Technology, Business
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
1,335
On SlideShare
0
From Embeds
0
Number of Embeds
5
Actions
Shares
0
Downloads
19
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

XNA-in-a-Day

  1. 1. XNA-in-a-Day Introduction to XNA Game Studio
  2. 2. Ed Donahue I love my life because… I get to travel! @creepyed creepyed.comAcademic Developer Evangelist I love my job because… I love my life because…Mid-Atlantic Region I help people build cool I have random dance parties!(MD, DC, VA, WV, NC, SC) technology!Developer & Platform Evangelism(DPE) I love my job because… I get to share my passion for technology with students!
  3. 3. GETTING STARTED
  4. 4. The Tools You Need• A computer – A decent card if you want graphics acceleration• Windows – Windows 7 works well• Visual Studio or Visual C# – Visual Studio 2010 Professional – available to students through DreamSpark• XNA Game Studio – Current version – XNA Game Studio 4.0 ed.donahue@microsoft.com | creepyed.com | @creepyed
  5. 5. What is DreamSpark?o DreamSpark provides free Microsoft software to verified students around the world for FREE!Who is eligible for DreamSpark?o All part-time and full-time students are entitled to DreamSpark softwareWhat software can they get from DreamSpark?o Visual Studio 2010 Professional, Expression Studio 4 Ultimate, Windows Server, SQL Servero Free appHub account for Windows Phone 7 Marketplaceo One year free subscription to XNA Creators Clubo 90 days of free Pluralsight training
  6. 6. www.DreamSpark.com to register
  7. 7. Visual Studio• Integrated Development Environment• Main code window• Solution Explorer• Toolbars and menus ed.donahue@microsoft.com | creepyed.com | @creepyed
  8. 8. Creating a game• Create new project• Basic structure of game project – Initialize – LoadContent (and UnloadContent) – Update – Draw• GraphicsDeviceManager• SpriteBatch (we’ll revisit) ed.donahue@microsoft.com | creepyed.com | @creepyed
  9. 9. ACTUALLY CREATINGA GAME…
  10. 10. Adding Assets• http://bit.ly/XNADayFiles• Content – what is it• Add content to project ed.donahue@microsoft.com | creepyed.com | @creepyed
  11. 11. Preparing Assets (Background)• Texture2D• ContentManager• Content.Load• viewPortRect ed.donahue@microsoft.com | creepyed.com | @creepyed
  12. 12. Using Assets• Draw() method• 2D graphical assets - SpriteBatch ed.donahue@microsoft.com | creepyed.com | @creepyed
  13. 13. Now for some fun stuff• Cannon – Loaded in the same way – Drawn in the same way – Not quite! ed.donahue@microsoft.com | creepyed.com | @creepyed
  14. 14. GameObject Class• Sprite Texture• Position – Vector2.Zero• Center• Rotation – Float ed.donahue@microsoft.com | creepyed.com | @creepyed
  15. 15. Cannon Take 2• Declare• Load – and set position• Draw – Using GameObject properties …• Interact ed.donahue@microsoft.com | creepyed.com | @creepyed
  16. 16. INTERACTION
  17. 17. Interaction Part 1• Cannon Rotation – Shorthand operator += – Thumbstick – Restricting movement• Keyboard control too – Conditional compilation #if• Change Draw method ed.donahue@microsoft.com | creepyed.com | @creepyed
  18. 18. Cannonballs - setup• GameObject updates – Velocity – Alive• Constants and Arrays• Loops – for – foreach and condition to draw ed.donahue@microsoft.com | creepyed.com | @creepyed
  19. 19. Interaction Part 2• State – GamePad and Keyboard – Define objects – Retrieve and save state ed.donahue@microsoft.com | creepyed.com | @creepyed
  20. 20. Cannonballs - firing• Buttons.A == ButtonState.Pressed – Previous state should be Released (make them work for it)• Automatic Method creation• Rotation in Radians – Cos/Sin math functions• return to exit loop ed.donahue@microsoft.com | creepyed.com | @creepyed
  21. 21. Cannonballs - moving• Position + Velocity• Is it still visible? – viewPortRect.Contains(Point) ed.donahue@microsoft.com | creepyed.com | @creepyed
  22. 22. Something to shoot at (1)• Same as cannonballs – Array Declaration – Load Content – Draw – Update if alive ed.donahue@microsoft.com | creepyed.com | @creepyed
  23. 23. Something to shoot at (2)• Different from cannonballs – Update if not alive – Set Velocity – Set Position – Set Alive ed.donahue@microsoft.com | creepyed.com | @creepyed
  24. 24. Introducing randomness• Random• Random.NextDouble• Lerp - MathHelper function – Interpolate number within range ed.donahue@microsoft.com | creepyed.com | @creepyed
  25. 25. Contact!• Compare cannonballs and enemies• Create virtual Rectangles• Check Intersect ed.donahue@microsoft.com | creepyed.com | @creepyed
  26. 26. Scoring - SpriteFont• Create• Declare• Load• Draw ed.donahue@microsoft.com | creepyed.com | @creepyed
  27. 27. WHERE TO NEXT?
  28. 28. Particle System• Use – 2D textures – Randomness – Rotation, velocity, position ed.donahue@microsoft.com | creepyed.com | @creepyed
  29. 29. Imagine CupVIDEOS!ed.donahue@microsoft.com | creepyed.com | @creepyed
  30. 30. Windows Phone 7• Converting to Windows Phone 7 (or Xbox 360).• Add touch support• Take it to the next level ed.donahue@microsoft.com | creepyed.com | @creepyed
  31. 31. Windows Phone 7 - Touch• Add Reference• Get TouchPanel state• Check TouchLocation state ed.donahue@microsoft.com | creepyed.com | @creepyed
  32. 32. Starter Kits• Platformer• RPG• Space Shooter• Racing ed.donahue@microsoft.com | creepyed.com | @creepyed
  33. 33. ScriptTD• Tower defense game engine• Customizable images and audio• scriptTD.codeplex.com ed.donahue@microsoft.com | creepyed.com | @creepyed

×