Jump to content

Few (n00b) game.Animation() questions


ambidex
 Share

Recommended Posts

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/0000

button/0001

button/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. 

Link to comment
Share on other sites

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, textures

will be in reverse order:

var anim = game.Animation.fromFrames('burger-run', true);

Hope that helps you!

Link to comment
Share on other sites

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. ;)

Link to comment
Share on other sites

Hi @enpu

 

The part where the error happens is here

var 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 collision
ufoBody.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.
Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

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