Creating A Player

From TRCCompSci - AQA Computer Science
Revision as of 00:01, 18 March 2017 by Admin (talk | contribs) (Created page with " You need to create a new class, so from the main menu click File, and select New File. 600px You will have the following code: <syntaxhighlight...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

You need to create a new class, so from the main menu click File, and select New File.

New file class.png

You will have the following code:

 1 using System;
 2 namespace TestGame
 3 {
 4 	public class Player
 5 	{
 6 		public Player()
 7 		{
 8 		}
 9 	}
10 }

The public class Player line is the class definition, and public Player is the constructor for the class. You need to add the following lines within the using section:

using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;

This will allow the class to access the MonoGame framework and SDK. Now to add the methods to setup, update and draw the player. So add the following methods into the player class:

public void Initialize()
{

}

public void Update()
{

}

public void Draw()
{

}