2. Ed Donahue
I love my life because…
I get to travel!
@creepyed creepyed.com
Academic 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!
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.
6. 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 software
What software can they get from DreamSpark?
o Visual Studio 2010 Professional, Expression Studio 4 Ultimate, Windows
Server, SQL Server
o Free appHub account for Windows Phone 7 Marketplace
o One year free subscription to XNA Creators Club
o 90 days of free Pluralsight training
8. Visual Studio
• Integrated Development Environment
• Main code window
• Solution Explorer
• Toolbars and menus
ed.donahue@microsoft.com | creepyed.com | @creepyed
9. 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
18. 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
19. Cannonballs - setup
• GameObject updates
– Velocity
– Alive
• Constants and Arrays
• Loops
– for
– foreach and condition to draw
ed.donahue@microsoft.com | creepyed.com | @creepyed
20. Interaction Part 2
• State – GamePad and Keyboard
– Define objects
– Retrieve and save state
ed.donahue@microsoft.com | creepyed.com | @creepyed
21. 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
22. Cannonballs - moving
• Position + Velocity
• Is it still visible?
– viewPortRect.Contains(Point)
ed.donahue@microsoft.com | creepyed.com | @creepyed
23. Something to shoot at (1)
• Same as cannonballs
– Array Declaration
– Load Content
– Draw
– Update if alive
ed.donahue@microsoft.com | creepyed.com | @creepyed
24. 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
25. Introducing randomness
• Random
• Random.NextDouble
• Lerp - MathHelper function
– Interpolate number within range
ed.donahue@microsoft.com | creepyed.com | @creepyed
31. 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
32. Windows Phone 7 - Touch
• Add Reference
• Get TouchPanel state
• Check TouchLocation state
ed.donahue@microsoft.com | creepyed.com | @creepyed
33. Starter Kits
• Platformer
• RPG
• Space Shooter
• Racing
ed.donahue@microsoft.com | creepyed.com | @creepyed
34. ScriptTD
• Tower defense game engine
• Customizable images and audio
• scriptTD.codeplex.com
ed.donahue@microsoft.com | creepyed.com | @creepyed