Introduction to Game Development Using C# and Monogame Part 1

Charlie Chiarelli, Experienced Online Educator

Play Speed
  • 0.5x
  • 1x (Normal)
  • 1.25x
  • 1.5x
  • 2x
11 Videos (1h 20m)
    • Welcome

      1:20
    • Why MonoGame? ... Some Background

      3:27
    • What You Need

      7:40
    • Creating Your First Monogame Project

      7:12
    • Managing Content

      4:25
    • Displaying The Content... The Sprites

      12:00
    • Moving The Sprites

      5:51
    • The Velocity Vector

      5:49
    • Hitting The Wall !

      6:53
    • Drawing Text

      9:30
    • Adding Background Music and Sound Effects

      16:04

About This Class

e30486c0

Video games are on our computers, our consoles and our phones! Lots of people play them and every year more people are making them. If you have ever played a computer game and thought, “I wonder how they do that?” or, better yet, “I want to make something like that,” then this course will get you started. Game development is what got many developers into programming. But how many of us actually ever learned how to create games? Creating games can be challenging, but it doesn’t have to be that way! MonoGame is a cross platform gaming framework based on Microsoft’s XNA framework that’s extremely easy to learn. Best of all, games you build with MonoGame will run on iOS, Android, Mac OS X, tvOS, Windows, Linux, PlayStation 4, and more—write once, play anywhere.

There’s no shortage of options when it comes to game development environments. From full-featured engines like Unity to comprehensive and complex multimedia APIs like DirectX, it can be hard to know where to start. MonoGame is a set of tools, with a level of complexity falling somewhere between a game engine and a grittier API like DirectX. It provides an easy-to-use content pipeline, and all the functionality required to create lightweight games that run on a wide variety of platforms. Best of all, MonoGame apps are written in pure C#, and you can distribute them quickly via the Microsoft Store or other similar distribution platforms.

This course assumes that you’ve done a little bit of  programming in C# but  all the material starts at the most basic level. That means that anyone should be able to join in and work their way through the material.

In Part 1 we cover

  • Learn to use the MonoGame Windows Project Template
  • Run your first MonoGame program
  • Understanding the underlying Template code
    • Directives (using)
    • Game1 Class
    • Instance Variables (SpriteBatch)
    • The Constructor ... Game1()
    • The Initialize Method
    • The LoadContent Method
    • The Update Method
    • The Draw Method
  • Set up the Pipeline Tool 
  • Learn to add assets to our project using the Pipeline Tool
    • images ... bmp, jpg, png (best)
    • audio ... wav , mp3
  • Organize content into folders 
  • Create a place to store the images (instance variable of type Texture2D)
  • Load the images into the instance variables
  • Draw the images using SpriteBatch (object used to do drawing)
    • using the Draw command
  • Introduce the concept motion in Monogame
  • Learn how to use the Vector2 class to create objects which indicate the sprite location of our images
  • Use the Update method to change our Sprite Location
  • Use the Draw Method to redisplay our sprite at its new location
  • Introduce the concept of velocity
    • we add a velocity instance variable from the Vector2 class which will be used to move our image , instead of using a constant
  • Introduce/Review some basic Vector addition concepts from mathematics
  • Discuss the screen constraints
    • where exactly (X location ) is the right and left walls
    • where exactly (Y location ) is the top and bottom walls
  • Create a program which has the image bounce off any part of the walls it encounters
  • Learn how to create a Sprite Font using the Pipeline Tool
    • Edit the Font (XML)
  • Use the Sprite Font to display a count of the number of wall collisions
    • Using the DrawString command
  • How to add sounds to your Mono Game Project
  • First we add directives 
    • using Microsoft.Xna.Framework.Media
    • using Microsoft.Xna.Framework.Audio
  • Next add instance variables of the Song and SoundEffect classes
  • Next we load the sounds
  • Lastly we Play the sounds at the desired location in the program 
    • Background music (songs) can be started  right at the beginning
      • mp3s work best with songs ...
        • but can use wavs ... need to force pipeline tool to change processor type from wav to song
      • can't play two songs at same time one will cancel out the other
    • SoundEffects are activated at a specified point in your game like hitting an object 
      • wavs are used for Sound Effects
      • multiple sound effects can play at the same time... can play over the background music 

10

Students

--

Projects

Charlie Chiarelli

Experienced Online Educator

Hi, my name is Charlie Chiarelli. I'll be your teacher for this course. I will spend as much time as necessary to help you do the best you can. But, for you to succeed you must be willing to work .

I am a retired High school Computer Science and Mathematics Teacher from Canada. I taught for 35 years, I have a BMath degree from the University of Waterloo.

I was a frequent speaker at educational conferences (ECOO) and seminars . Most recently my talks focused on E-Learning and the...

See full profile