Get current animation frame
  • Hi,
    i need to get the current frame number of current animation, because there's some stuff i need to do at certain point of a character's move, for example if he's shooting something i need to release the bullet just 2 frames before the shooting animation ends. Can i do something like that, possibily without having to split the animation in n parts calling the callback fuction for each of them?
    Thanks :)
  • No at the moment it isn't possible. But I can see the usecase for this and will think about adding it to the library.
    For now you will have to use the workaround you described.
  • Selim, i just wrote this function in the lib:

    getAnimationFrame: function () {
    var gameQuery = this[0].gameQuery;
    return gameQuery.currentFrame;
    }

    then i call it just by

    var a = $("#player").getAnimationFrame();


    is that ok? it works independently for every sprite, right?
  • Yep, should be ok for every sprites.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!