public override void LoadContent(Microsoft.Xna.Framework.Content.ContentManager content, InputManager input) { base.LoadContent(content, input); hit = false; fileManager = new FileManager(); moveAnimation = new SpriteSheetAnimation(); Vector2 temptFrames = Vector2.Zero; fileManager.LoadContent("Load/Enemy.cme", attributes, contents); for (int i = 0; i < attributes.Count; i++) { for (int j = 0; j < attributes[i].Count; j++) { switch (attributes[i][j]) { case "Health": health = int.Parse(contents[i][j]); max_health = health; break; case "Frames": string[] frames = contents[i][j].Split(' '); temptFrames = new Vector2(int.Parse(frames[0]), int.Parse(frames[1])); break; case "Image": image = this.content.Load<Texture2D>(contents[i][j]); break; case "Position": frames = contents[i][j].Split(' '); position = new Vector2(int.Parse(frames[0]), int.Parse(frames[1])); break; } } } moveAnimation.Frames = temptFrames; moveAnimation.LoadContent(content, image, "", position); moveAnimation.Scale = 1f; enemy_img = this.content.Load<Texture2D>(@"enemy"); }
//Sprite Sheet loading. Page 41 public override void LoadContent(ContentManager content, InputManager inputManager) { base.LoadContent(content, inputManager); fileManager = new FileManager(); moveAnimation = new SpriteSheetAnimation(); Vector2 temptFrames = Vector2.Zero; fileManager.LoadContent("Load/Player.cme", attributes, contents); for (int i = 0; i < attributes.Count; i++) { for (int j = 0; j < attributes[i].Count; j++) { switch (attributes[i][j]) { case "Health": health = int.Parse(contents[i][j]); max_health = health; break; case "Frames": string[] frames = contents[i][j].Split(' '); temptFrames = new Vector2(int.Parse(frames[0]), int.Parse(frames[1])); break; case "Image": image = this.content.Load<Texture2D>(contents[i][j]); break; case "Position": frames = contents[i][j].Split(' '); position = new Vector2(int.Parse(frames[0]), int.Parse(frames[1])); break; } } } bulletLoad = new List<Bullet>(); bullet_img = this.content.Load<Texture2D>(@"bullet"); sound_volume = 0.10f; moveAnimation.Frames = temptFrames; moveAnimation.LoadContent(content, image, "", position); shoot_sound = this.content.Load<SoundEffect>(@"Audios/shoot_audio"); player_img = this.content.Load<Texture2D>(@"player_sprite"); }