Example #1
0
 /// <summary>
 /// Allows the game component to perform any initialization it needs to before starting
 /// to run.  This is where it can query for any required services and load content.
 /// </summary>
 public override void Initialize()
 {
     sprites        = Game.Content.Load <Texture2D>(@"Images\spritesheet");
     spriteBatch    = new SpriteBatch(Game.GraphicsDevice);
     map            = Game.Services.GetService(typeof(TileMap)) as TileMap;
     gp             = Game.Services.GetService(typeof(GamePadStates)) as GamePadStates;
     pixelsPerFrame = map.TileDimensions.X / NumWalkingFrames;
     base.Initialize();
 }
Example #2
0
 /// <summary>
 /// Allows the game to perform any initialization it needs to before starting to run.
 /// This is where it can query for any required services and load any non-graphic
 /// related content.  Calling base.Initialize will enumerate through any components
 /// and initialize them as well.
 /// </summary>
 protected override void Initialize()
 {
     graphics.PreferredBackBufferHeight = graphics.PreferredBackBufferWidth = 500;
     graphics.ApplyChanges();
     Window.Title      = "CS 4173, Assignment 4 – Bill Good";
     map               = new TileMap(this, @"Content\Maps\map.tmx");
     map.DrawOrder     = 1;
     camera            = new Camera(this);
     myActor           = new Actor(this);
     myActor.DrawOrder = 2;
     gp             = new GamePadStates(this, PlayerIndex.One);
     gp.UpdateOrder = int.MinValue;             // please make this update first!
     Services.AddService(typeof(TileMap), map);
     Services.AddService(typeof(Camera), camera);
     Services.AddService(typeof(GamePadStates), gp);
     Components.Add(map);
     Components.Add(camera);
     Components.Add(myActor);
     Components.Add(gp);
     camera.Monitor(map);
     camera.Monitor(myActor, true);
     base.Initialize();
 }
Example #3
0
 /// <summary>
 /// Allows the game to perform any initialization it needs to before starting to run.
 /// This is where it can query for any required services and load any non-graphic
 /// related content.  Calling base.Initialize will enumerate through any components
 /// and initialize them as well.
 /// </summary>
 protected override void Initialize()
 {
     graphics.PreferredBackBufferHeight = graphics.PreferredBackBufferWidth = 500;
     graphics.ApplyChanges();
     Window.Title = "CS 4173, Assignment 4 – Bill Good";
     map = new TileMap(this, @"Content\Maps\map.tmx");
     map.DrawOrder = 1;
     camera = new Camera(this);
     myActor = new Actor(this);
     myActor.DrawOrder = 2;
     gp = new GamePadStates(this, PlayerIndex.One);
     gp.UpdateOrder = int.MinValue; // please make this update first!
     Services.AddService(typeof(TileMap), map);
     Services.AddService(typeof(Camera), camera);
     Services.AddService(typeof(GamePadStates), gp);
     Components.Add(map);
     Components.Add(camera);
     Components.Add(myActor);
     Components.Add(gp);
     camera.Monitor(map);
     camera.Monitor(myActor, true);
     base.Initialize();
 }
Example #4
0
 /// <summary>
 /// Allows the game component to perform any initialization it needs to before starting
 /// to run.  This is where it can query for any required services and load content.
 /// </summary>
 public override void Initialize()
 {
     sprites = Game.Content.Load<Texture2D>(@"Images\spritesheet");
     spriteBatch = new SpriteBatch(Game.GraphicsDevice);
     map = Game.Services.GetService(typeof(TileMap)) as TileMap;
     gp = Game.Services.GetService(typeof(GamePadStates)) as GamePadStates;
     pixelsPerFrame = map.TileDimensions.X / NumWalkingFrames;
     base.Initialize();
 }