Skip to content

Instantly share code, notes, and snippets.

@trunghieuvn
Created November 9, 2018 15:14
Show Gist options
  • Save trunghieuvn/5c5738e23e67128c0d62b2ffc6a13712 to your computer and use it in GitHub Desktop.
Save trunghieuvn/5c5738e23e67128c0d62b2ffc6a13712 to your computer and use it in GitHub Desktop.
check null
var anim = this.getComponent(cc.Animation);
if(anim != null)
{
anim.play();
var anim = this.getComponent(cc.Animation);
var animState = anim.play("TigerRun");
// accelerate the playing speed of animation
animState.speed = 2;
animState.wrapMode = cc.WrapMode.Loop;
anim.playAdditive("TigerRun");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment