SlideShare a Scribd company logo
Getting Started with
MonoGame using 2D
DARKSIDE OF MONOGAME
SIMON JACKSON
AUTHOR AND MICROSOFT MVP
@SIMONDARKSIDEJ
What this tutorial covers
• Basic Concepts
• Game Loop
• Content
• Your First 2D project
• Build Content Project
• Create Project
• Add code and assets
• The Bigger Picture
• Project Structure
• State Management
• Tips ‘N’Tricks
*Doesn’t include instructions on HOW to code :D
Check the original 2D starter course I did for that
http://bit.ly/2mT2pQd
Or check out Rob Miles’s “LittleYellow Book”
http://www.csharpcourse.com/
Update
Loop
Content
&
Drawing
Handling
Input
Audio
Basic 2D / Game Development
concepts
WHAT MAKES A GAME?
Simple Concepts
• Game - XNA Game definition
• Graphics Device - The Graphics card definition
• Sprite Batch - 2D Batch drawing call
• Content Manager - The Content Pipeline
• Vectors / Rectangles /Textures - MonoGame structures
• Game Loop - The loop the game
• Initialize (while running) goes through to deliver
• Update your game
• Draw
The Game Loop
• Set Initial State
• Load Content
Initialize
• Handle Input
• Apply Physics
• Set Position
Update • Draw
Background
• Draw Foreground
• Apply Shaders
Draw
2D Drawing
JUST GETTING SOME STUFF ON THE SCREEN
Drawing in 2D – Order is important
When drawing a 2D game (or any other type tbh), the order in which
you draw them is very important:
• Drawing is done from back to the front
• Things drawn first begin at the back
• Additional calls draw on top of each other
• Same as if you were drawing with paint on a canvas
Coordinates
When drawing in 2D, the top-left of the screen is the start of the screen.
Or inVector terms –Vector2(0,0)
Values then increase:
• Across to the right for X
• Downwards forY
Any object drawn to the screen
follows the same pattern
X Positive ->
YPositive->
Position
Vector2(10,10)
Effects
It is also possible to apply effects to images / text as they are drawn, either:
• Individually
• A group of images
• To the entire screen
This can allow you to:
• Blend colors together
• Overwrite portions
• Anything else your mind has to dream
Input & Animation
MAKING STUFF MOVE
Input
Input is handled as a “state” between each game update loop.
MonoGame checks what the new position is for each type of input, you have
to decide what to do with that information.
In most games, you preserve the previous state of input, to determine if the
player has:
• Just pressed an input
• Just released an input
• Is holding an input
Once you know the player has done something, you decide what to do with
that information.
Animation
Animation, like the movies, is just a way to fool humans that an image
is actually moving. This is achieved in games by either:
• Moving the image across the screen between frames
• Replacing the image with a slightly different image
• A combination of both of these
MonoGame can support both:
• Individual images for animation
• Multiple images combined on a single image with multiple “frames”
of animation. Also known as Spritesheets.
Animation
SINGLE TEXTURE
SPRITE SHEET
MULTIPLE IMAGES
Frame 1 Frame 2 Frame 3
Audio
ADDING SOME SOUND
Audio
Audio comes in two forms within the MonoGame Framework:
• Sound – Fire and forget, just play and go
• Sound Instance – More control, used for music and deeper effects
• Song – Music and looping audio
Audio is loaded from the Content Manger like any other asset
Then you can either:
• Just play is as required, e.g. Fire a bullet
• Create an instance and play, loop, increase/decrease pitch, etc
Enough talk
SHOW ME THE CODE
Going further
MANAGING THE STATE OF YOUR GAME
Game State Management
Games are more than just the gameplay, to be complete you will also
need:
• Menus
• Configuration / Settings screens
• Help / info pages
• More levels?
As you only have ONE game loop, you need to enable your game to
understand the different “states” your game will be in.
This is referred to as Game State Management
Game State Management
sample
MANAGING THE STATE OF YOUR GAME EXAMPLE
Further Reading
WHERE CAN YOU LEARN MORE
More information
Many sources exist to detail more about basic 2D drawing:
• http://www.monogame.rocks/documentation
A good start but docs still aWIP
• http://www.monogame.rocks/documentation/?page=Tutorials
A selection of other MonoGame tutorials, some old but still relevant
• https://github.com/DDReaper/XNAGameStudio
Archived Microsoft XNA samples. A great “how to” selection.
Most are being converted over to MonoGame direct, like the
GameStateManagement sample
• The Darkside of MonoGame
http://www.youtube.com/c/TheDarksideofMonoGame
Either where you are watching this from or where you should go next!
Thanks for watching
DARKSIDE OF MONOGAME
SIMON JACKSON
AUTHOR AND MICROSOFT MVP
@SIMONDARKSIDEJ

More Related Content

What's hot

Game Development Club Universitas Multimedia Nusantara - Game Design Crash Co...
Game Development Club Universitas Multimedia Nusantara - Game Design Crash Co...Game Development Club Universitas Multimedia Nusantara - Game Design Crash Co...
Game Development Club Universitas Multimedia Nusantara - Game Design Crash Co...
Albert Van Otto
 
Aquaria Analyzis
Aquaria AnalyzisAquaria Analyzis
Aquaria Analyzis
Cecilia Bexander
 
Windows 7 Tips And Tricks
Windows 7 Tips And TricksWindows 7 Tips And Tricks
Windows 7 Tips And Tricks
Chad Massaker
 
USMAN YAR
USMAN YARUSMAN YAR
USMAN YAR
muhammad irfan
 
Mobile GameDevelopment using Flash Lite
Mobile GameDevelopment using Flash LiteMobile GameDevelopment using Flash Lite
Mobile GameDevelopment using Flash Lite
Juwal Bose
 
Inserting background
Inserting backgroundInserting background
Inserting background
Ann Alcid
 
Windows 7 Tips And Tricks
Windows 7 Tips And TricksWindows 7 Tips And Tricks
Windows 7 Tips And Tricks
BBH Solutions
 
Gaming Outline
Gaming OutlineGaming Outline
Gaming Outline
IMGTeched
 
FGS 2011: How I Built A $10,000/month Flash Game In My Spare Time
FGS 2011: How I Built A $10,000/month Flash Game In My Spare TimeFGS 2011: How I Built A $10,000/month Flash Game In My Spare Time
FGS 2011: How I Built A $10,000/month Flash Game In My Spare Time
mochimedia
 
How to Take Screenshots on Any Device
How to Take Screenshots on Any DeviceHow to Take Screenshots on Any Device
How to Take Screenshots on Any Device
Sov KimKhung
 
CSUN 2018 Dont Play Me - 2 Games in Web Accessibility
CSUN 2018 Dont Play Me - 2 Games in Web AccessibilityCSUN 2018 Dont Play Me - 2 Games in Web Accessibility
CSUN 2018 Dont Play Me - 2 Games in Web Accessibility
Ted Gies
 
Dc menu map power point
Dc menu map power pointDc menu map power point
Dc menu map power point
Sam Ybarra
 
Up cloth - GameDesignDoccument
Up cloth - GameDesignDoccumentUp cloth - GameDesignDoccument
Up cloth - GameDesignDoccument
Eléonore Arbaux
 
Sony Digital Video Camera
Sony Digital Video CameraSony Digital Video Camera
Sony Digital Video Camera
B. Hamilton
 
Scenario map fruit pastilles
Scenario map fruit pastillesScenario map fruit pastilles
Scenario map fruit pastilles
joconnor62
 
Unit 4: Production Reflection
Unit 4: Production ReflectionUnit 4: Production Reflection
Unit 4: Production Reflection
Louis Dowson
 
JoshuaGrey-2DGameWorkflow
JoshuaGrey-2DGameWorkflowJoshuaGrey-2DGameWorkflow
JoshuaGrey-2DGameWorkflow
Joshgrey16
 
Sound Slide Tutorial
Sound Slide TutorialSound Slide Tutorial
Sound Slide Tutorial
adamperez
 
p2 unit 3
p2 unit 3p2 unit 3
p2 unit 3
Sophiepfc
 
Vuvuzela flow and wireframes
Vuvuzela   flow and wireframesVuvuzela   flow and wireframes
Vuvuzela flow and wireframes
Peter Blom
 

What's hot (20)

Game Development Club Universitas Multimedia Nusantara - Game Design Crash Co...
Game Development Club Universitas Multimedia Nusantara - Game Design Crash Co...Game Development Club Universitas Multimedia Nusantara - Game Design Crash Co...
Game Development Club Universitas Multimedia Nusantara - Game Design Crash Co...
 
Aquaria Analyzis
Aquaria AnalyzisAquaria Analyzis
Aquaria Analyzis
 
Windows 7 Tips And Tricks
Windows 7 Tips And TricksWindows 7 Tips And Tricks
Windows 7 Tips And Tricks
 
USMAN YAR
USMAN YARUSMAN YAR
USMAN YAR
 
Mobile GameDevelopment using Flash Lite
Mobile GameDevelopment using Flash LiteMobile GameDevelopment using Flash Lite
Mobile GameDevelopment using Flash Lite
 
Inserting background
Inserting backgroundInserting background
Inserting background
 
Windows 7 Tips And Tricks
Windows 7 Tips And TricksWindows 7 Tips And Tricks
Windows 7 Tips And Tricks
 
Gaming Outline
Gaming OutlineGaming Outline
Gaming Outline
 
FGS 2011: How I Built A $10,000/month Flash Game In My Spare Time
FGS 2011: How I Built A $10,000/month Flash Game In My Spare TimeFGS 2011: How I Built A $10,000/month Flash Game In My Spare Time
FGS 2011: How I Built A $10,000/month Flash Game In My Spare Time
 
How to Take Screenshots on Any Device
How to Take Screenshots on Any DeviceHow to Take Screenshots on Any Device
How to Take Screenshots on Any Device
 
CSUN 2018 Dont Play Me - 2 Games in Web Accessibility
CSUN 2018 Dont Play Me - 2 Games in Web AccessibilityCSUN 2018 Dont Play Me - 2 Games in Web Accessibility
CSUN 2018 Dont Play Me - 2 Games in Web Accessibility
 
Dc menu map power point
Dc menu map power pointDc menu map power point
Dc menu map power point
 
Up cloth - GameDesignDoccument
Up cloth - GameDesignDoccumentUp cloth - GameDesignDoccument
Up cloth - GameDesignDoccument
 
Sony Digital Video Camera
Sony Digital Video CameraSony Digital Video Camera
Sony Digital Video Camera
 
Scenario map fruit pastilles
Scenario map fruit pastillesScenario map fruit pastilles
Scenario map fruit pastilles
 
Unit 4: Production Reflection
Unit 4: Production ReflectionUnit 4: Production Reflection
Unit 4: Production Reflection
 
JoshuaGrey-2DGameWorkflow
JoshuaGrey-2DGameWorkflowJoshuaGrey-2DGameWorkflow
JoshuaGrey-2DGameWorkflow
 
Sound Slide Tutorial
Sound Slide TutorialSound Slide Tutorial
Sound Slide Tutorial
 
p2 unit 3
p2 unit 3p2 unit 3
p2 unit 3
 
Vuvuzela flow and wireframes
Vuvuzela   flow and wireframesVuvuzela   flow and wireframes
Vuvuzela flow and wireframes
 

Similar to Getting started with MonoGame using 2D

Game cih
Game cihGame cih
Game cih
Harsh Malpani
 
Kodu game design
Kodu game designKodu game design
Kodu game design
Philip Sweezey
 
Easy coding a multi device game with FireMonkey
Easy coding a multi device game with FireMonkeyEasy coding a multi device game with FireMonkey
Easy coding a multi device game with FireMonkey
pprem
 
98 374 Lesson 03-slides
98 374 Lesson 03-slides98 374 Lesson 03-slides
98 374 Lesson 03-slides
Tracie King
 
How to Stream Video Games: A Primer on Twitch.tv
How to Stream Video Games: A Primer on Twitch.tvHow to Stream Video Games: A Primer on Twitch.tv
How to Stream Video Games: A Primer on Twitch.tv
Digital Surgeons
 
Game Salad Study
Game Salad StudyGame Salad Study
Game Salad Study
Young-Min kang
 
Windows Phone XNA Games
Windows Phone XNA GamesWindows Phone XNA Games
Windows Phone XNA Games
Bret Stateham
 
XNA for Windows Phone
XNA for Windows PhoneXNA for Windows Phone
XNA for Windows Phone
Ed Donahue
 
Lecture 1 Introduction to VR Programming
Lecture 1 Introduction to VR ProgrammingLecture 1 Introduction to VR Programming
Lecture 1 Introduction to VR Programming
Kobkrit Viriyayudhakorn
 
Monkey Rush Android Game
Monkey Rush Android GameMonkey Rush Android Game
Monkey Rush Android Game
Dinuka S.J Kuruppuarachchi
 
Unity 3d Basics
Unity 3d BasicsUnity 3d Basics
Unity 3d Basics
Chaudhry Talha Waseem
 
Cocos2d game programming 1
Cocos2d game programming 1Cocos2d game programming 1
Cocos2d game programming 1
Changwon National University
 
Developing great games for Windows 8 by Lorenzo Barbieri
Developing great games for Windows 8 by Lorenzo BarbieriDeveloping great games for Windows 8 by Lorenzo Barbieri
Developing great games for Windows 8 by Lorenzo Barbieri
Codemotion
 
Chapt 1 (part 2) installing the sdk and exploring the workspace
Chapt 1 (part 2)   installing the sdk and exploring the workspaceChapt 1 (part 2)   installing the sdk and exploring the workspace
Chapt 1 (part 2) installing the sdk and exploring the workspace
Muhd Basheer
 
Street runner final
Street runner finalStreet runner final
Street runner final
Kumar Narayan
 
02 unity 3_d_part_1
02 unity 3_d_part_102 unity 3_d_part_1
02 unity 3_d_part_1
Reham Maher El-Safarini
 
Presentación Unity
Presentación UnityPresentación Unity
Presentación Unity
Laura Milena Parra Navarro
 
Polybot Onboarding Process
Polybot Onboarding ProcessPolybot Onboarding Process
Polybot Onboarding Process
Nina Park
 
Hackathon 2013 - The Art Of Cheating In Games
Hackathon 2013 - The Art Of Cheating In GamesHackathon 2013 - The Art Of Cheating In Games
Hackathon 2013 - The Art Of Cheating In Games
Souhail Hammou
 
1. case study
1. case study1. case study
1. case study
William Thirlaway
 

Similar to Getting started with MonoGame using 2D (20)

Game cih
Game cihGame cih
Game cih
 
Kodu game design
Kodu game designKodu game design
Kodu game design
 
Easy coding a multi device game with FireMonkey
Easy coding a multi device game with FireMonkeyEasy coding a multi device game with FireMonkey
Easy coding a multi device game with FireMonkey
 
98 374 Lesson 03-slides
98 374 Lesson 03-slides98 374 Lesson 03-slides
98 374 Lesson 03-slides
 
How to Stream Video Games: A Primer on Twitch.tv
How to Stream Video Games: A Primer on Twitch.tvHow to Stream Video Games: A Primer on Twitch.tv
How to Stream Video Games: A Primer on Twitch.tv
 
Game Salad Study
Game Salad StudyGame Salad Study
Game Salad Study
 
Windows Phone XNA Games
Windows Phone XNA GamesWindows Phone XNA Games
Windows Phone XNA Games
 
XNA for Windows Phone
XNA for Windows PhoneXNA for Windows Phone
XNA for Windows Phone
 
Lecture 1 Introduction to VR Programming
Lecture 1 Introduction to VR ProgrammingLecture 1 Introduction to VR Programming
Lecture 1 Introduction to VR Programming
 
Monkey Rush Android Game
Monkey Rush Android GameMonkey Rush Android Game
Monkey Rush Android Game
 
Unity 3d Basics
Unity 3d BasicsUnity 3d Basics
Unity 3d Basics
 
Cocos2d game programming 1
Cocos2d game programming 1Cocos2d game programming 1
Cocos2d game programming 1
 
Developing great games for Windows 8 by Lorenzo Barbieri
Developing great games for Windows 8 by Lorenzo BarbieriDeveloping great games for Windows 8 by Lorenzo Barbieri
Developing great games for Windows 8 by Lorenzo Barbieri
 
Chapt 1 (part 2) installing the sdk and exploring the workspace
Chapt 1 (part 2)   installing the sdk and exploring the workspaceChapt 1 (part 2)   installing the sdk and exploring the workspace
Chapt 1 (part 2) installing the sdk and exploring the workspace
 
Street runner final
Street runner finalStreet runner final
Street runner final
 
02 unity 3_d_part_1
02 unity 3_d_part_102 unity 3_d_part_1
02 unity 3_d_part_1
 
Presentación Unity
Presentación UnityPresentación Unity
Presentación Unity
 
Polybot Onboarding Process
Polybot Onboarding ProcessPolybot Onboarding Process
Polybot Onboarding Process
 
Hackathon 2013 - The Art Of Cheating In Games
Hackathon 2013 - The Art Of Cheating In GamesHackathon 2013 - The Art Of Cheating In Games
Hackathon 2013 - The Art Of Cheating In Games
 
1. case study
1. case study1. case study
1. case study
 

More from Simon Jackson

Getting started with mono game using cli
Getting started with mono game using cliGetting started with mono game using cli
Getting started with mono game using cli
Simon Jackson
 
Getting started with mono game on visual studio for mac
Getting started with mono game on visual studio for macGetting started with mono game on visual studio for mac
Getting started with mono game on visual studio for mac
Simon Jackson
 
Getting started with mono game on visual studio 2019
Getting started with mono game on visual studio 2019Getting started with mono game on visual studio 2019
Getting started with mono game on visual studio 2019
Simon Jackson
 
Mixed Reality Toolkit Release Candidate upgrade
Mixed Reality Toolkit Release Candidate upgradeMixed Reality Toolkit Release Candidate upgrade
Mixed Reality Toolkit Release Candidate upgrade
Simon Jackson
 
Mixed Reality Toolkit - Controller model replacement
Mixed Reality Toolkit - Controller model replacementMixed Reality Toolkit - Controller model replacement
Mixed Reality Toolkit - Controller model replacement
Simon Jackson
 
Mixed Reality Toolkit - Introduction to configuration
Mixed Reality Toolkit - Introduction to configurationMixed Reality Toolkit - Introduction to configuration
Mixed Reality Toolkit - Introduction to configuration
Simon Jackson
 
Mixed Reality Toolkit - Quickstart
Mixed Reality Toolkit - QuickstartMixed Reality Toolkit - Quickstart
Mixed Reality Toolkit - Quickstart
Simon Jackson
 
Mixed Reality Introduction
Mixed Reality IntroductionMixed Reality Introduction
Mixed Reality Introduction
Simon Jackson
 
MonoGame extensions & engines
MonoGame extensions & enginesMonoGame extensions & engines
MonoGame extensions & engines
Simon Jackson
 

More from Simon Jackson (9)

Getting started with mono game using cli
Getting started with mono game using cliGetting started with mono game using cli
Getting started with mono game using cli
 
Getting started with mono game on visual studio for mac
Getting started with mono game on visual studio for macGetting started with mono game on visual studio for mac
Getting started with mono game on visual studio for mac
 
Getting started with mono game on visual studio 2019
Getting started with mono game on visual studio 2019Getting started with mono game on visual studio 2019
Getting started with mono game on visual studio 2019
 
Mixed Reality Toolkit Release Candidate upgrade
Mixed Reality Toolkit Release Candidate upgradeMixed Reality Toolkit Release Candidate upgrade
Mixed Reality Toolkit Release Candidate upgrade
 
Mixed Reality Toolkit - Controller model replacement
Mixed Reality Toolkit - Controller model replacementMixed Reality Toolkit - Controller model replacement
Mixed Reality Toolkit - Controller model replacement
 
Mixed Reality Toolkit - Introduction to configuration
Mixed Reality Toolkit - Introduction to configurationMixed Reality Toolkit - Introduction to configuration
Mixed Reality Toolkit - Introduction to configuration
 
Mixed Reality Toolkit - Quickstart
Mixed Reality Toolkit - QuickstartMixed Reality Toolkit - Quickstart
Mixed Reality Toolkit - Quickstart
 
Mixed Reality Introduction
Mixed Reality IntroductionMixed Reality Introduction
Mixed Reality Introduction
 
MonoGame extensions & engines
MonoGame extensions & enginesMonoGame extensions & engines
MonoGame extensions & engines
 

Recently uploaded

Haunted Houses by H W Longfellow for class 10
Haunted Houses by H W Longfellow for class 10Haunted Houses by H W Longfellow for class 10
Haunted Houses by H W Longfellow for class 10
nitinpv4ai
 
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptxC1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
mulvey2
 
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem studentsRHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
Himanshu Rai
 
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptxNEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
iammrhaywood
 
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptxPrésentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
siemaillard
 
How to Predict Vendor Bill Product in Odoo 17
How to Predict Vendor Bill Product in Odoo 17How to Predict Vendor Bill Product in Odoo 17
How to Predict Vendor Bill Product in Odoo 17
Celine George
 
How to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 InventoryHow to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 Inventory
Celine George
 
Educational Technology in the Health Sciences
Educational Technology in the Health SciencesEducational Technology in the Health Sciences
Educational Technology in the Health Sciences
Iris Thiele Isip-Tan
 
Standardized tool for Intelligence test.
Standardized tool for Intelligence test.Standardized tool for Intelligence test.
Standardized tool for Intelligence test.
deepaannamalai16
 
Walmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdfWalmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdf
TechSoup
 
Mule event processing models | MuleSoft Mysore Meetup #47
Mule event processing models | MuleSoft Mysore Meetup #47Mule event processing models | MuleSoft Mysore Meetup #47
Mule event processing models | MuleSoft Mysore Meetup #47
MysoreMuleSoftMeetup
 
Nutrition Inc FY 2024, 4 - Hour Training
Nutrition Inc FY 2024, 4 - Hour TrainingNutrition Inc FY 2024, 4 - Hour Training
Nutrition Inc FY 2024, 4 - Hour Training
melliereed
 
Electric Fetus - Record Store Scavenger Hunt
Electric Fetus - Record Store Scavenger HuntElectric Fetus - Record Store Scavenger Hunt
Electric Fetus - Record Store Scavenger Hunt
RamseyBerglund
 
Pengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptxPengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptx
Fajar Baskoro
 
Chapter wise All Notes of First year Basic Civil Engineering.pptx
Chapter wise All Notes of First year Basic Civil Engineering.pptxChapter wise All Notes of First year Basic Civil Engineering.pptx
Chapter wise All Notes of First year Basic Civil Engineering.pptx
Denish Jangid
 
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) CurriculumPhilippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
MJDuyan
 
Juneteenth Freedom Day 2024 David Douglas School District
Juneteenth Freedom Day 2024 David Douglas School DistrictJuneteenth Freedom Day 2024 David Douglas School District
Juneteenth Freedom Day 2024 David Douglas School District
David Douglas School District
 
Wound healing PPT
Wound healing PPTWound healing PPT
Wound healing PPT
Jyoti Chand
 
Lifelines of National Economy chapter for Class 10 STUDY MATERIAL PDF
Lifelines of National Economy chapter for Class 10 STUDY MATERIAL PDFLifelines of National Economy chapter for Class 10 STUDY MATERIAL PDF
Lifelines of National Economy chapter for Class 10 STUDY MATERIAL PDF
Vivekanand Anglo Vedic Academy
 
Jemison, MacLaughlin, and Majumder "Broadening Pathways for Editors and Authors"
Jemison, MacLaughlin, and Majumder "Broadening Pathways for Editors and Authors"Jemison, MacLaughlin, and Majumder "Broadening Pathways for Editors and Authors"
Jemison, MacLaughlin, and Majumder "Broadening Pathways for Editors and Authors"
National Information Standards Organization (NISO)
 

Recently uploaded (20)

Haunted Houses by H W Longfellow for class 10
Haunted Houses by H W Longfellow for class 10Haunted Houses by H W Longfellow for class 10
Haunted Houses by H W Longfellow for class 10
 
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptxC1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
 
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem studentsRHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
 
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptxNEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
 
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptxPrésentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
 
How to Predict Vendor Bill Product in Odoo 17
How to Predict Vendor Bill Product in Odoo 17How to Predict Vendor Bill Product in Odoo 17
How to Predict Vendor Bill Product in Odoo 17
 
How to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 InventoryHow to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 Inventory
 
Educational Technology in the Health Sciences
Educational Technology in the Health SciencesEducational Technology in the Health Sciences
Educational Technology in the Health Sciences
 
Standardized tool for Intelligence test.
Standardized tool for Intelligence test.Standardized tool for Intelligence test.
Standardized tool for Intelligence test.
 
Walmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdfWalmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdf
 
Mule event processing models | MuleSoft Mysore Meetup #47
Mule event processing models | MuleSoft Mysore Meetup #47Mule event processing models | MuleSoft Mysore Meetup #47
Mule event processing models | MuleSoft Mysore Meetup #47
 
Nutrition Inc FY 2024, 4 - Hour Training
Nutrition Inc FY 2024, 4 - Hour TrainingNutrition Inc FY 2024, 4 - Hour Training
Nutrition Inc FY 2024, 4 - Hour Training
 
Electric Fetus - Record Store Scavenger Hunt
Electric Fetus - Record Store Scavenger HuntElectric Fetus - Record Store Scavenger Hunt
Electric Fetus - Record Store Scavenger Hunt
 
Pengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptxPengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptx
 
Chapter wise All Notes of First year Basic Civil Engineering.pptx
Chapter wise All Notes of First year Basic Civil Engineering.pptxChapter wise All Notes of First year Basic Civil Engineering.pptx
Chapter wise All Notes of First year Basic Civil Engineering.pptx
 
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) CurriculumPhilippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
 
Juneteenth Freedom Day 2024 David Douglas School District
Juneteenth Freedom Day 2024 David Douglas School DistrictJuneteenth Freedom Day 2024 David Douglas School District
Juneteenth Freedom Day 2024 David Douglas School District
 
Wound healing PPT
Wound healing PPTWound healing PPT
Wound healing PPT
 
Lifelines of National Economy chapter for Class 10 STUDY MATERIAL PDF
Lifelines of National Economy chapter for Class 10 STUDY MATERIAL PDFLifelines of National Economy chapter for Class 10 STUDY MATERIAL PDF
Lifelines of National Economy chapter for Class 10 STUDY MATERIAL PDF
 
Jemison, MacLaughlin, and Majumder "Broadening Pathways for Editors and Authors"
Jemison, MacLaughlin, and Majumder "Broadening Pathways for Editors and Authors"Jemison, MacLaughlin, and Majumder "Broadening Pathways for Editors and Authors"
Jemison, MacLaughlin, and Majumder "Broadening Pathways for Editors and Authors"
 

Getting started with MonoGame using 2D

  • 1. Getting Started with MonoGame using 2D DARKSIDE OF MONOGAME SIMON JACKSON AUTHOR AND MICROSOFT MVP @SIMONDARKSIDEJ
  • 2. What this tutorial covers • Basic Concepts • Game Loop • Content • Your First 2D project • Build Content Project • Create Project • Add code and assets • The Bigger Picture • Project Structure • State Management • Tips ‘N’Tricks *Doesn’t include instructions on HOW to code :D Check the original 2D starter course I did for that http://bit.ly/2mT2pQd Or check out Rob Miles’s “LittleYellow Book” http://www.csharpcourse.com/ Update Loop Content & Drawing Handling Input Audio
  • 3. Basic 2D / Game Development concepts WHAT MAKES A GAME?
  • 4. Simple Concepts • Game - XNA Game definition • Graphics Device - The Graphics card definition • Sprite Batch - 2D Batch drawing call • Content Manager - The Content Pipeline • Vectors / Rectangles /Textures - MonoGame structures • Game Loop - The loop the game • Initialize (while running) goes through to deliver • Update your game • Draw
  • 5. The Game Loop • Set Initial State • Load Content Initialize • Handle Input • Apply Physics • Set Position Update • Draw Background • Draw Foreground • Apply Shaders Draw
  • 6. 2D Drawing JUST GETTING SOME STUFF ON THE SCREEN
  • 7. Drawing in 2D – Order is important When drawing a 2D game (or any other type tbh), the order in which you draw them is very important: • Drawing is done from back to the front • Things drawn first begin at the back • Additional calls draw on top of each other • Same as if you were drawing with paint on a canvas
  • 8. Coordinates When drawing in 2D, the top-left of the screen is the start of the screen. Or inVector terms –Vector2(0,0) Values then increase: • Across to the right for X • Downwards forY Any object drawn to the screen follows the same pattern X Positive -> YPositive-> Position Vector2(10,10)
  • 9. Effects It is also possible to apply effects to images / text as they are drawn, either: • Individually • A group of images • To the entire screen This can allow you to: • Blend colors together • Overwrite portions • Anything else your mind has to dream
  • 11. Input Input is handled as a “state” between each game update loop. MonoGame checks what the new position is for each type of input, you have to decide what to do with that information. In most games, you preserve the previous state of input, to determine if the player has: • Just pressed an input • Just released an input • Is holding an input Once you know the player has done something, you decide what to do with that information.
  • 12. Animation Animation, like the movies, is just a way to fool humans that an image is actually moving. This is achieved in games by either: • Moving the image across the screen between frames • Replacing the image with a slightly different image • A combination of both of these MonoGame can support both: • Individual images for animation • Multiple images combined on a single image with multiple “frames” of animation. Also known as Spritesheets.
  • 13. Animation SINGLE TEXTURE SPRITE SHEET MULTIPLE IMAGES Frame 1 Frame 2 Frame 3
  • 15. Audio Audio comes in two forms within the MonoGame Framework: • Sound – Fire and forget, just play and go • Sound Instance – More control, used for music and deeper effects • Song – Music and looping audio Audio is loaded from the Content Manger like any other asset Then you can either: • Just play is as required, e.g. Fire a bullet • Create an instance and play, loop, increase/decrease pitch, etc
  • 17. Going further MANAGING THE STATE OF YOUR GAME
  • 18. Game State Management Games are more than just the gameplay, to be complete you will also need: • Menus • Configuration / Settings screens • Help / info pages • More levels? As you only have ONE game loop, you need to enable your game to understand the different “states” your game will be in. This is referred to as Game State Management
  • 19. Game State Management sample MANAGING THE STATE OF YOUR GAME EXAMPLE
  • 20. Further Reading WHERE CAN YOU LEARN MORE
  • 21. More information Many sources exist to detail more about basic 2D drawing: • http://www.monogame.rocks/documentation A good start but docs still aWIP • http://www.monogame.rocks/documentation/?page=Tutorials A selection of other MonoGame tutorials, some old but still relevant • https://github.com/DDReaper/XNAGameStudio Archived Microsoft XNA samples. A great “how to” selection. Most are being converted over to MonoGame direct, like the GameStateManagement sample • The Darkside of MonoGame http://www.youtube.com/c/TheDarksideofMonoGame Either where you are watching this from or where you should go next!
  • 22. Thanks for watching DARKSIDE OF MONOGAME SIMON JACKSON AUTHOR AND MICROSOFT MVP @SIMONDARKSIDEJ