public Player(ContentManager content) { // Loading the player from the XML current_sprite = content.Load<AnimatedSprite>("player"); // We need a shallow copy instance to handle the square player texture //opposite_sprite = (AnimatedSprite)current_sprite.Clone(); //opposite_sprite.textureName = "player_square"; //opposite_sprite.framesPerLine = 8; opposite_sprite = content.Load<AnimatedSprite>("player_square"); // Loading the content current_sprite.Load(); opposite_sprite.Load(); // Because we made only a shallow copy, this method will affect the square player too current_sprite.AddAllAnimations(); opposite_sprite.AddAllAnimations(); current_sprite.Init(); opposite_sprite.Init(); }
// Swaps between the round and square sprite public void swap() { isRound = !isRound; AnimatedSprite aux = current_sprite; current_sprite = opposite_sprite; opposite_sprite = aux; }