public void LoadContent(ContentManager myContentManager, SpriteFont font) { image = myContentManager.Load<Texture2D>("figur"); talkingimage = myContentManager.Load<Texture2D>("figurtalking"); imageascii = new Sprite(); imageascii.LoadContent(myContentManager, "at"); animimage = new AnimatedSprite("hero", "figur", image, 4, 9); talkimage = new AnimatedSprite("herotalking", "figurtalking", talkingimage, 4, 5); playerRect.Width = (animimage.Texture.Width / animimage.Columns) / 2; playerRect.Height = (animimage.Texture.Height / animimage.Rows) / 5; verbmenu.LoadContent(myContentManager, font); }
/// <summary> /// Add an animation /// </summary> /// <param name="myContentManager">XNA Contentmanager</param> /// <param name="imagename">Name of the image file in the XNA Contentpipelin</param> /// <param name="colum">Number of frames in one column of the image</param> /// <param name="row">Number of frames in one row of the image</param> /// <param name="name">Name of the new animation</param> /// <param name="speed">How fast the animation is going to be played</param> public void AddAniSprite(ContentManager myContentManager, String imagename, int colum, int row, string name, int speed) { Texture2D texture = myContentManager.Load<Texture2D>(imagename); AnimatedSprite NewAniSprite = new AnimatedSprite(name, imagename, texture, row, colum, speed); aniimages.Add(NewAniSprite); }