Setting Sprites
tk2dSprite Component
tk2dSprite thingy_sprite = thingy.GetComponent<tk2dSprite>();tk2dSprite thingy_sprite = thingy.AddComponent<tk2dSprite>();//If the texture you desire to switch to is in the sprite collection the tk2dSprite is already set to
thingy_sprite.SetSprite(newSpriteId);
//If the texture you desire to switch to is in a different sprite collection
//If the tk2dSprite is not yet set to a collection, then you must use this method
thingy_sprite.SetSprite(newCollection, newSpriteId);//Gets the tk2dSpriteCollectionData associated with the sprite of any gameobject
tk2dSpriteCollectionData arbitraryCollection = exampleGameobject.GetComponent<tk2dSprite>();
//or...
//...just use the Item collection already defined in Alexandria's SpriteBuilder
tk2dSpriteCollectionData itemSpriteCollection = SpriteBuilder.itemCollection;
//Don't forget to put using Alexandria.ItemAPI; at the top of your code!Applying a Sprite Change
Applications
Important Notes
Last updated
Was this helpful?