Jump to content

Latest Panda 2 Dev - fromFrames / fromTextures - SOLVED


Ninjadoodle
 Share

Recommended Posts

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!

Link to comment
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');

 

Link to comment
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!

Link to comment
Share on other sites

  • 1 month later...

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