Sign in to follow this  
Ninjadoodle

Latest Panda 2 Dev - fromFrames / fromTextures - SOLVED

Recommended Posts

Hi @enpu / guys

Has anyone managed to get fromFrames working to make an animation in latest v2 dev?

It looks like the function has changed to fromTextures - but I can't seem to get it working.

Thank in advance!

Share this post


Link to post
Share on other sites

Hi @enpu

 

Here is the code I'm trying ... (I've tried fromFrames and fromTextures).

Mouse = game.Class.extend({

    num: 0,
    blind: false,
    showing: false,

    init: function(x, y) {
        this.sprite = new game.Animation.fromFrames('mouseA');

        this.sprite.addAnim('show', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10])
        this.sprite.anims.show.speed = 60;
        this.sprite.anims.show.loop = false;

        this.sprite.addAnim('hide', [11, 12, 13, 14, 15, 16, 17, 18, 19, 0])
        this.sprite.anims.hide.speed = 60;
        this.sprite.anims.hide.loop = false;

        this.sprite.interactive = true;
        this.sprite.position.set(x, y);
        this.sprite.anchor.set(24, 32);
        this.sprite.addTo(game.scene.mg);
    }
});

... the only way I can get it to work, is to write up the frames/images individually.

Thank you!

Share this post


Link to post
Share on other sites

Hmmm ... I get when {} when I log the cache.

What Im confused about is that this works ...

Mouse = game.Class.extend({

    num: 0,
    blind: false,
    showing: false,

    init: function(x, y) {
        this.sprite = new game.Animation([
            'mouseA0001.png',
            'mouseA0002.png',
            'mouseA0003.png',
            'mouseA0004.png',
            'mouseA0005.png',
            'mouseA0006.png',
            'mouseA0007.png',
            'mouseA0008.png',
            'mouseA0009.png',
            'mouseA0010.png',

but this doesn't

Mouse = game.Class.extend({

    num: 0,
    blind: false,
    showing: false,

    init: function(x, y) {
        this.sprite = game.Animation.fromTextures('mouseA');

 

Share this post


Link to post
Share on other sites

Not in this case. Here they are single images (i'm having problems with the sprite sheets and @2x @4x etc. - they load at the wrong size - I posted on github)

I can attach the project if you need.

Share this post


Link to post
Share on other sites

Oh ok, sorry I didn't know that :( 

Thanks heaps for you help on this btw.

I'll have to wait for a fix on the sprite sheet problem I'm having with @2x @4x sheets, as right now it breaks my level lol.

If you need me to send you any test projects - please let me know!

PS. Again - really appreciate the help!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.