javascriptanimationcocos2d-xcocos2d-js

Cocos2d (JS) - Animation which is set OnLoad() and has propert isPlaying: true is not really playing at all


So i've made simple project in cocos2d added a heart sprite in the middle and tried to add an Animation do the heart sprite node (Just as it says on Cocos2d manual). Problem is that animation works in the Preview, but nothing seems to be moving while playing game.

What should i do?

I tried adding the clip as default, checked PlayOnLoad box, I also created script for the heart Node so that it starts the animation and logs the state of animation for me:

cc.Class(
{extends: cc.Component,


properties: {

},

// LIFE-CYCLE CALLBACKS:

// onLoad () {},

start () {
    var anim = this.getComponent(cc.Animation);
    cc.log(anim == null);

    var animState = anim.play();
    animState.wrapMode = cc.WrapMode.Loop;
    animState.repeatCount = Infinity;
    animState.speed = 1;
    cc.log(animState);
},});

it returns JSON that is saying that the animation is playing and all... but its not, what should i do?

I just want the animation to be played :(

EDIT: I found out that the animation is actually running, it's just property "eulerangles" which i was trying to use to animate heart's rotation wasn't really animating. I tried adding some position changes and they happen to work.


Solution

  • OK, so as it always is it was all my mistake for being an imbecil I was trying to use "EulerAngle" instead of "Angle" property, which was working in editor but nowhere else.

    Everything works fine, I'm sorry guys, i'll close this thread here.