Jump to content

how to change the spritesheet of the player without killing it


valueerror
 Share

Recommended Posts

lets say i have a sprite sheet with 20 frames and i create my animations out of it..

 

 now i want to change the look of the player completely - i want to change the spritesheet to another one with the exaxt same amount of frames so all my animations would also work with the new spritesheet...  but look differently.

 

for now i kill my player and recreate it on the same position..   this seems like a very dirty hack to me..

 

 

how to do it right?

 

 

Link to comment
Share on other sites

thx rich.. so i change the player sprite to 'skin2' instead of the initial 'skin1'  (key)   but that changes the sprite for about a milisecond until the next animation is called (for example 'walk') and since the animations are set up for the player at a time where it had 'skin1' the player changes back immediately..  

 

i thought that maybe there is a way to reinitialize the base spritesheet so everything else would change according to it..   i know this is not trivial since phaser would probably throw lots of errors if the other/new spritesheet is not exactly the same in terms of size, framenumber and so on..

 

i of course could pack both skins in one spritesheet and define ALL animations twice and then check for a custom variable and play either skin1 animations or skin2 animations.. but changing the base sprite and nothing else seems so much easier..

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...