skeddles Posted April 8, 2022 Share Posted April 8, 2022 (edited) I create an animated sprite for each of my animations, and store them in an object: Object.keys(GAME.playerSpriteData.animations).forEach(animation => { GAME.playerSprites[animation] = new PIXI.AnimatedSprite(GAME.player.spritesheet.animations[animation]); }); I set the initial animation: GAME.player.sprite = GAME.playerSprites['down']; How do I change the sprite to another? Doing this later does nothing: GAME.player.sprite = GAME.playerSprites['up'] I also tried: GAME.player.sprite.textures = GAME.playerSprites['up'].textures Edited April 8, 2022 by skeddles Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted April 8, 2022 Share Posted April 8, 2022 the last option should work, whats wrong with it? Quote Link to comment Share on other sites More sharing options...
skeddles Posted April 8, 2022 Author Share Posted April 8, 2022 you're right, it does work, no idea why it didn't the first time i tried it ivan.popelyshev 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.