leomachado666, you might need to add more information...
you havent really shown us what you are trying to do..in the overall plan of your game..
there are so many ways to change players views and swap out images or animations...
you might need to break it down to simplistic form first then expand on the idea..
As far as I know.
one object sprite cannot call another object sprites specific animation view ..unless they are named the same per object..but it runs into troubles if you dont use Families..
I would suggest that you make a Family of sprite objects that are all the character object sprites..
This way you can call each family members animations by the same family name and it should work perfectly across the various classes of character..
Does that make sense?
use Families, its this kind of thing that Families are specifically used for ..
groups of similar objects that you want to all affect with the same rules or events
Each object sprite has its own animations ..but im pretty sure the animation names can be shared across different sprites....
So you can just swap out several object sprites quite easily...but you need to make sure that you can call the right animation for the right object at the right time, in relation to the Family its in
You are going to need a system that can handle that request....It might take more planning out than you have done so far...
So first off, you would need an invisible platformer controller object with some instance variables that represent the player classes
Then you need a check to see which variable the player selected
and then spawn the correct object sprite(with its animations) at the player controller sprite
of course you may need to destroy the older or existing object character sprite ..
then you need a way to trigger the right animations across the different sprites no matter what class is selected.
ive done it before...by having a character menu screen but this is not the only way..you might want to swap character class in game...
so if the player chooses archer you would would just check what the player chose by looking at what variable was selected and then create the required object (with its unique animations) at the player controller location and pin it..
By the sounds of it you need to plan out your systems and code structure before you go doing things like this..
Its always better to build systems that control your events rather than just dropping in events
what I mean is..
plan out and create a system that handles the player changing mechanic that you are trying to make
its all about systems
you need structure and a good plan to make it work...
things I would consider are
1- How does the player chose what class eg: is there a player select screen or is it done in the action part of the game or via a shop or whatnot?
2- make sure the system is streamlined and optimised so that it doesnt take up all the processor time to swapp out the player objects..
3-make it robust as well
Basically you would need to elaborate alot more before you could get the best answer..
but yeah....try swapping objects by relating it to a variable that tracks the players choice of character either in game or in menus...
sprite objects can have unlimited animations im pretty sure so use the right object for the right job and you should be fine..
hope that clears something up