比如这两个函数里
_animationEventHandler: function(event) {
if (event.type === dragonBones.EventObject.FADE_IN_COMPLETE) {
//if (event.detail.animationState.name === “jump_1”) {
if (event.animationState.name === “jump_1”) {
this._isJumpingB = true;
this._speedY = -JUMP_SPEED;
this._armature.animation.fadeIn(“jump_2”, -1, -1, 0, NORMAL_ANIMATION_GROUP);
// } else if (event.detail.animationState.name === “jump_4”) {
} else if (event.animationState.name === “jump_4”) {
this._updateAnimation();
}
}
else if (event.type === dragonBones.EventObject.FADE_OUT_COMPLETE) {
// if (event.detail.animationState.name === “attack_01”) {
if (event.animationState.name === “attack_01”) {
this._isAttackingB = false;
this._attackState = null;
}
}
},
_frameEventHandler : function (event) {
// if (event.detail.name === "onFire") {
if (event.name === "onFire") {
// var firePointBone = event.detail.armature.getBone("firePoint");
var firePointBone = event.armature.getBone("firePoint");
var localPoint = cc.v2(firePointBone.global.x, -firePointBone.global.y);
// var display = event.detail.armature.display;
var display = event.armature.display;
var globalPoint = display.node.convertToWorldSpace(localPoint);
this._fire(globalPoint);
}
},
按照例子动行就报错了。注释掉的是例子里的。
``
var DragonBullet = cc.Class({
name: ‘DragonBullet’,
_speedX : 0,
_speedY : 0,
_armature : null,
_armatureDisplay : null,
_effect : null,
init : function (parentNode, armature, effect, radian, speed, position) {
this._speedX = Math.cos(radian) * speed;
this._speedY = -Math.sin(radian) * speed;
var thePos = parentNode.convertToNodeSpace(position);
this._armature = armature;
this._armatureDisplay = this._armature;//._armature.display;
//this._armatureDisplay.setPosition(thePos);
this._armature.node.setPosition(thePos);
this._armatureDisplay.rotation = radian * dragonBones.DragonBones.RADIAN_TO_ANGLE;
//this._armature.animation.play("idle");
this._armature.playAnimation("idle");
if (effect) {
this._effect = effect;
var effectDisplay = this._effect;//.display;
effectDisplay.node.rotation = radian * dragonBones.DragonBones.RADIAN_TO_ANGLE;
effectDisplay.node.setPosition(thePos);
effectDisplay.node.scaleX = 1 + Math.random() * 1;
effectDisplay.node.scaleY = 1 + Math.random() * 0.5;
if (Math.random() < 0.5) {
effectDisplay.node.scaleY *= -1;
}
// this._effect.animation.play("idle");
this._effect.playAnimation("idle");
dragonBones.WorldClock.clock.add(this._effect);
parentNode.addChild(effectDisplay.node);
}
dragonBones.WorldClock.clock.add(this._armature);
parentNode.addChild(this._armatureDisplay.node);
},
还有这个函数里的。