startupper Posted June 9, 2017 Share Posted June 9, 2017 I'm a little irritated at the moment.A sprite sheet is to be loaded and displayed. The sprite sheet consists of several individual images (2, 3, ... 5, ... 10, ... any). I would like to change these pictures.Unfortunately, I find no suitable example. On the basis of an animation, with Play and Change Texture, it can not be, it is always only a single picture to the next switch.Does anyone have a suggestion? Thank you.PS: Of course, I also have a JASON file to it. Link to comment Share on other sites More sharing options...
FlashyGoblin Posted June 9, 2017 Share Posted June 9, 2017 Are you looking to use frames from multiple spritesheets for a single animation? I don't think you can mix frames fromendifferent sources that way. Or are you looking to switch to a new texture on a sprite for new animations? This can be done. After loading a new texture on the sprite, you will need to redefine the animations, then play the animation. Im away from my computer ATM, so I can't show you and example. I'll try to the next time I'm able of you haven't gotten it to work till then. Link to comment Share on other sites More sharing options...
startupper Posted June 9, 2017 Author Share Posted June 9, 2017 Hey Flashy,It is one Spritesheet. One JSON-File. Maybe i mean "change texture"!?I just want to exchange pictures.If ..., then go from picture 1 to picture 2.If ..., what else, then go from picture 2 to picture 3. Later i build it then with buttons, or something else, depending on how I need it.As I said, animation play I think for overflow, because there are only standing images, no anis. Link to comment Share on other sites More sharing options...
deepsky88 Posted June 9, 2017 Share Posted June 9, 2017 just create more than one animation and put animations.play into the if, example on your example: a = animation from 1 to 2; b = animation from 2 to 3; if.... a.play else....b.play i'm noob here but i think this can be work Link to comment Share on other sites More sharing options...
FlashyGoblin Posted June 9, 2017 Share Posted June 9, 2017 I believe you can then just set the frame property of the sprite. sprite.frame = 1; sprite.frame = 2;, etc. Link to comment Share on other sites More sharing options...
FlashyGoblin Posted June 9, 2017 Share Posted June 9, 2017 Or sprite.animations.currentFrame = 1; https://phaser.io/docs/2.6.2/Phaser.AnimationManager.html#currentFrame Link to comment Share on other sites More sharing options...
startupper Posted June 9, 2017 Author Share Posted June 9, 2017 In the company I have no FTP.To all abundance is just now my XAMPP crashed o_oI will try all suggestions afterwards. The one from Flashy looks pretty easy.But I thank you already Link to comment Share on other sites More sharing options...
Recommended Posts