ambidex Posted October 15, 2014 Share Posted October 15, 2014 Hi there, first of all, lovin' Panda.js, awesome work to the people developing it out there. Isn't there an easier way of importing a sequence of spritesheet frames? Like I've got:button/0000button/0001button/0002...up to 0019 I now have to define each single frame line by line, I would expect it a lot easier like game.Animation('button/') or something like that. Also, the above animation, I need it in reserve playback. I couldn't find any method or property to make it reverse it. I even tried making the animationSpeed negative, though this makes the entire engine go bezerk. Would love to hear back from you guys! I thank you in advance. Quote Link to comment Share on other sites More sharing options...
enpu Posted October 15, 2014 Share Posted October 15, 2014 You are absolutely right, there should be easier way! I have just added game.Animation.fromFrames helper function into develop branch. No you should be able to do it like this:var anim = game.Animation.fromFrames('button');That will go through whole texture cache and take every texture that contains string button, and returns new Animation instance with those textures. Afaik, there is no way in Pixi to play animation in reverse, yet. So i added second parameter to fromFrames function, if you set it to true, textureswill be in reverse order:var anim = game.Animation.fromFrames('burger-run', true);Hope that helps you! Ninjadoodle 1 Quote Link to comment Share on other sites More sharing options...
ambidex Posted October 15, 2014 Author Share Posted October 15, 2014 Wow, that's absolutely amazing that you already fixed a new feature for that. Thanks a ton! Since we're developing an app that should be going live in about 4 weeks, is it safe to checkout the develop branch for this new feature? Or should we wait for a stable release on the master branch in our product? I sure am going to check the new feature out right now, thanks again! Edit: Works like a charm! Awesome. Though one small note: I had to use: var animation = game.Animation.fromFrames('button/', true);Note the suffixing slash, otherwise it will use the entire spritesheet as well. Which from my point of view is entirely logical and totally acceptable, but might help someone else out. Quote Link to comment Share on other sites More sharing options...
Ninjadoodle Posted October 15, 2014 Share Posted October 15, 2014 You are a legend enpu! Quote Link to comment Share on other sites More sharing options...
enpu Posted October 15, 2014 Share Posted October 15, 2014 @ambidex, i'm using develop version on my current projects, and have not spotted any issues, so it should be safe Quote Link to comment Share on other sites More sharing options...
Ninjadoodle Posted October 16, 2014 Share Posted October 16, 2014 Hi enpu I've tried the new game.Animation.fromFrames helper function, but I seem to get some inconsistencies. When trying to advance through frames, the sequence won't act like it would if it was setup the old way (from image) and will sometimes skip frames. Not sure what's causing this Quote Link to comment Share on other sites More sharing options...
Ninjadoodle Posted October 16, 2014 Share Posted October 16, 2014 I've just restarted the web server and it worked for a while, but it's playing up again. Quote Link to comment Share on other sites More sharing options...
enpu Posted October 17, 2014 Share Posted October 17, 2014 Can you show your code? Quote Link to comment Share on other sites More sharing options...
Ninjadoodle Posted October 17, 2014 Share Posted October 17, 2014 Hi @enpu The part where the error happens is herevar ufoBody = new game.Animation([ game.Texture.fromImage('levelWarmingUp/ufoBody0001.png'), game.Texture.fromImage('levelWarmingUp/ufoBody0002.png'), game.Texture.fromImage('levelWarmingUp/ufoBody0003.png'), game.Texture.fromImage('levelWarmingUp/ufoBody0004.png')]);ufoBody.anchor.set(0.5, 0);ufoBody.position.set(0, -6);ufo.addChild(ufoBody);then, on collisionufoBody.gotoAndStop(ufoBody.currentFrame + 1);This works flawlessly when using the Panda master version ... however when I use the develop version, the animation sometimes jumps frames and sometimes doesn't change at all. Thank you again! PS. the code for the level I have is quite long to post here ... so if you need it I can send it to you. Quote Link to comment Share on other sites More sharing options...
enpu Posted October 17, 2014 Share Posted October 17, 2014 I think you have some outdated code there, try this:var ufoBody = new game.Animation( 'levelWarmingUp/ufoBody0001.png', 'levelWarmingUp/ufoBody0002.png', 'levelWarmingUp/ufoBody0003.png', 'levelWarmingUp/ufoBody0004.png'); Quote Link to comment Share on other sites More sharing options...
Ninjadoodle Posted October 17, 2014 Share Posted October 17, 2014 Hi @enpu Thank you for the help on this ... I tried the above code and still the same thing .... sometimes the animation will progress to the last image of the sequence, then the second image next etc. It's random and sometimes it works, but most of the time the its shows out of order. Quote Link to comment Share on other sites More sharing options...
enpu Posted October 17, 2014 Share Posted October 17, 2014 Can't see anything wrong with your code, so if you can send your full code, i can take a look Quote Link to comment Share on other sites More sharing options...
Ninjadoodle Posted October 18, 2014 Share Posted October 18, 2014 Hi @enpu I sent you a message with 2 of my levels and detailing the problem. It should hopefully be organised well enough Thank you heaps for having a look at this! 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.