public void AddAnimation(string animationKey, string textureName, CelCount celCount, int framesPerSecond) { if (!textures.ContainsKey(textureName)) { textures.Add(textureName, Game.Content.Load <Texture2D>( contentPath + textureName)); } int celWidth = (int)(textures[textureName].Width / celCount.NumberOfColumns); int celHeight = (int)(textures[textureName].Height / celCount.NumberOfRows); int numberOfCels = celCount.NumberOfColumns * celCount.NumberOfRows; //we create a cel range by passing in start location of 1,1 //and end with number of column and rows //2,1 = 1,1,2,1 ; 4,2 = 1,1,4,2 AddAnimation(animationKey, textureName, new CelRange(1, 1, celCount.NumberOfColumns, celCount.NumberOfRows), celWidth, celHeight, numberOfCels, framesPerSecond); }
public void AddAnimation(string animationKey, string textureName, CelCount celCount, int framesPerSecond) { if (!textures.ContainsKey(textureName)) { textures.Add(textureName, Game.Content.Load <Texture2D>( contentPath + textureName)); } int celWidth = (int)(textures[textureName].Width / celCount.NumberOfColumns); int celHeight = (int)(textures[textureName].Height / celCount.NumberOfRows); int numberOfCels = celCount.NumberOfColumns * celCount.NumberOfRows; AddAnimation(animationKey, textureName, new CelRange(1, 1, celCount.NumberOfColumns, celCount.NumberOfRows), celWidth, celHeight, 125 /*numberOfCels*/, framesPerSecond); }