/// <summary> /// Loads the player sprite sheet and sounds. /// </summary> public void LoadContent() { // Load animated textures. idleAnimation = new Animation(Level.Content.Load <Texture2D>("Sprites/Player/cop_idle"), 0.1f, true); runAnimation = new Animation(Level.Content.Load <Texture2D>("Sprites/Player/cop_running"), 0.1f, true); jumpAnimation = new Animation(Level.Content.Load <Texture2D>("Sprites/Player/cop_jump"), 0.1f, false); celebrateAnimation = new Animation(Level.Content.Load <Texture2D>("Sprites/Player/Celebrate"), 0.1f, false); dieAnimation = new Animation(Level.Content.Load <Texture2D>("Sprites/Player/cop_die"), 0.1f, false); rollAnimation = new Animation(Level.Content.Load <Texture2D>("Sprites/Player/cop_roll2"), 0.1f, false); grenadeAnimation = new Animation(Level.Content.Load <Texture2D>("Sprites/Player/cop_grenade"), 0.1f, false); killedSound = Level.Content.Load <SoundEffect>("Sounds/killedSound"); jumpSound = Level.Content.Load <SoundEffect>("Sounds/jumpSound"); rollSound = Level.Content.Load <SoundEffect>("Sounds/rollSound"); hitSound = Level.Content.Load <SoundEffect>("Sounds/hitSound"); // Calculate bounds within texture size. int width = (int)(idleAnimation.FrameWidth * 0.4); int left = (idleAnimation.FrameWidth - width) / 2; int height = (int)(idleAnimation.FrameWidth * 0.8); int top = idleAnimation.FrameHeight - height; localBounds = new Rectangle(left, top, width, height); m_handgun = new HandGun(level, position, this); m_shotgun = new Shotgun(level, position, this); m_knife = new Knife(level, position, this); m_bomb = new Grenade(level, position, this); weapon = m_handgun; font = level.Content.Load <SpriteFont>("Fonts/Hud"); }
/// <summary> /// Loads the player sprite sheet and sounds. /// </summary> public void LoadContent() { // Load animated textures. idleAnimation = new Animation(Level.Content.Load<Texture2D>("Sprites/Player/cop_idle"), 0.1f, true); runAnimation = new Animation(Level.Content.Load<Texture2D>("Sprites/Player/cop_running"), 0.1f, true); jumpAnimation = new Animation(Level.Content.Load<Texture2D>("Sprites/Player/cop_jump"), 0.1f, false); celebrateAnimation = new Animation(Level.Content.Load<Texture2D>("Sprites/Player/Celebrate"), 0.1f, false); dieAnimation = new Animation(Level.Content.Load<Texture2D>("Sprites/Player/cop_die"), 0.1f, false); rollAnimation = new Animation(Level.Content.Load<Texture2D>("Sprites/Player/cop_roll2"), 0.1f, false); grenadeAnimation = new Animation(Level.Content.Load<Texture2D>("Sprites/Player/cop_grenade"), 0.1f, false); killedSound = Level.Content.Load<SoundEffect>("Sounds/killedSound"); jumpSound = Level.Content.Load<SoundEffect>("Sounds/jumpSound"); rollSound = Level.Content.Load<SoundEffect>("Sounds/rollSound"); hitSound = Level.Content.Load<SoundEffect>("Sounds/hitSound"); // Calculate bounds within texture size. int width = (int)(idleAnimation.FrameWidth * 0.4); int left = (idleAnimation.FrameWidth - width) / 2; int height = (int)(idleAnimation.FrameWidth * 0.8); int top = idleAnimation.FrameHeight - height; localBounds = new Rectangle(left, top, width, height); m_handgun = new HandGun(level, position, this); m_shotgun = new Shotgun(level, position, this); m_knife = new Knife(level, position, this); m_bomb = new Grenade(level, position, this); weapon = m_handgun; font = level.Content.Load<SpriteFont>("Fonts/Hud"); }