2D Toolkit Forum
2D Toolkit => Support => Topic started by: MrPriest on March 11, 2015, 07:19:43 am
-
Hello.
I've been trying to add a sprite collection (don't remember the exact name, not near my project right now) via code.
I don't see any errors, but I also do not see anything being generated visually.
Basically I have a character game object, and the moves/stats/sprite are loaded when the player chooses the character they want to play as (fighter).
It works when I drag the game objects myself, but rather than have a game object for each character, I'd like to have one game object that can load any character data.
I do not have the code with me right now, but how would you accomplish it?
-
You will need to AddComponent<tk2dSprite> and then call SetSprite to set the actual sprite to what you want. You'll need a reference to a tk2dSpriteCollectionData.
-
I believe that this is what I have done.
I'll get home (at work currently) and verify.
Either way, thanks for replying!