Jump to content

animation frames problem


LinkTree
 Share

Recommended Posts

Hi, I am having a problem with using animation frames loaded with game.addAsset. I followed the example here:

http://vermeire.home.xs4all.nl/panda/fiddler.html under "frame based animation" and he shows how he loads all the assets using game.addAsset and giving each asset a name and then calling each asset by it's name in new game.Animation().

 

but when I tried loading the assets into game.Animation() like this:

//---this is inside assets.js---game.addAsset('sequence/frame1.png', 'frame1');game.addAsset('sequence/frame2.png', 'frame2');game.addAsset('sequence/frame3.png', 'frame3');game.addAsset('sequence/frame4.png', 'frame4');game.addAsset('sequence/frame5.png', 'frame5');//---this is inside main.js in game scene 'Game's init function ---this.sequence = new game.Animation(   'frame1',   'frame2',   'frame3',   'frame4',   'frame5',);this.sequence.animationSpeed = 0.25;this.sequence.play();game.scene.stage.addChild(this.sequence);

it didn't work and console log was displaying localhost/"root game dir"/frame[num]                 [HTTP/1.1 404 Not Found 1ms]

note that it wasn't looking inside the media directory or the sequence directory that's inside media.

 

what am I doing wrong?

 

thanks.

Link to comment
Share on other sites

Ok I made this work by adding frames = game.paths[frames] || frames; to game.Animation function in renderer.js so it looks like this:

game.Animation = function(textures) {    /**        Play animation in reverse.        @property {Boolean} reverse        @default false    **/    this.reverse = false;    if (typeof textures === 'string') {        var frames = Array.prototype.slice.call(arguments);        var textures = [];        for (var i = 0; i < frames.length; i++) {            frames[i] = game.paths[frames[i]] || frames[i];            textures.push(game.Texture.fromImage(frames[i]));        }    }    game.PIXI.MovieClip.call(this, textures);};

I am not sure if there are any bad implications for doing this. please let me know if it's wrong.

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