diff --git a/SpriteLibrary/Sprite.cs b/SpriteLibrary/Sprite.cs index a810874..749caba 100644 --- a/SpriteLibrary/Sprite.cs +++ b/SpriteLibrary/Sprite.cs @@ -252,7 +252,7 @@ namespace SpriteLibrary /// public bool MirrorVertically = false; - SpriteController MySpriteController; + internal SpriteController MySpriteController; private bool _Destroying = false; /// /// If the Sprite is in the middle of being Destroyed, this is set to true. When a Sprite is diff --git a/SpriteLibrary/SpriteController.cs b/SpriteLibrary/SpriteController.cs index 4b39f93..de1d7c1 100644 --- a/SpriteLibrary/SpriteController.cs +++ b/SpriteLibrary/SpriteController.cs @@ -976,6 +976,7 @@ namespace SpriteLibrary { //If we get here, we do not have it in our list. Add it to this controller and then return it AddSprite(Found); + //Console.WriteLine("Found A Sprite in another controller:" + Found.SpriteName); return Found; } } @@ -1003,6 +1004,7 @@ namespace SpriteLibrary /// The sprite to add to the sprite-controller public void AddSprite(Sprite SpriteToAdd) { + SpriteToAdd.MySpriteController = this; Sprites.Add(SpriteToAdd); AddSpriteToLinkedControllers(SpriteToAdd); SortSprites(); @@ -1016,8 +1018,12 @@ namespace SpriteLibrary { if (SpriteToAdd.SpriteName == "") return; //We only add named sprites Sprite found = SpriteFromName(SpriteToAdd.SpriteName); - if(found == null) - Sprites.Add(SpriteToAdd); + if (found == null) + { + Sprite Clone = new Sprite(SpriteToAdd,true); + Clone.MySpriteController = this; + Sprites.Add(Clone); + } } ///