Ok, I’ve been wondering how I would pull this off… so first off, I have a character right? I have it setup in SM2 with only one animation at the moment. What I want to have is a Castle Crashers like setup where I can change my weapon at like the beginning level or something, and then it will stay with that weapon until you change it again. Would I need it to like swap prefabs or something with each different animation with the different weapon? I don’t know what to do Anyone have any ideas? Thanks!
Sorry for bumping… But the thread is going down Anyway, did I post this in the right topic?
I’m not sure what SM2 is?
- But if you have an animated character in Unity (say a Skinned Mesh, rigged, with bones), you can just attach any weapon to the appropriate body part (eg. Left hand) by making the weapon a child of the bone… right?
If you want to take this a step further, you could even have a bone that is for the weapon, allowing you more control of over the animation of the weapon.
Hope this helps?
Oh sorry, SM2 is SpriteManager 2… haha. So there are no individual limbs, just a Gameobject with a sprite script. Thanks for trying to help anyway!
-Blayke
right! well I guess if it’s a sprite, you will have to use entirely different sprites to change the weapons?
Well, I think so, but I want it to where when I change the weapon, the next time I play the game it will save that weapon. And I want it to instantly change, like in this clip. http://www.youtube.com/watch?v=sAh2hcjOnuM#t=1m36s
Thanks so much!
Save the current weapon selection to PlayerPrefs.
Awesome! Thanks for that… but how would I instantly swap sprites in the character, since each weapon has a different amount of damage and such? Thanks for helping me this far
-Blayke
Save to PlayerPrefs a short string, something like:
“weapon1” or “weapon2”
then when you load the Prefs back in, just ask:
IF == “weapon1” THEN assign the variables using values for that particular weapon type.
Thanks! I think that solved my problem Thanks for all the help!
-Blayke