cc.Class({ extends: cc.Component, properties: { }, start () { }, onCollisionEnter: function (other) { if(other.node.name === 'PlayerCollisionLine') { var Level = this.node.parent.parent; var Canvas = Level.getComponent('LevelControl').Canvas; var GameStates = Canvas.getComponent('GameStates'); // other.node.parent.getComponent('HeroControl').ResetSpeed(); var scene = cc.director.getScene(); // cc.log("父亲",scene); var charactor = scene.getChildByName("Hero").getChildByName("Player").getComponent("Charactor"); charactor.readyRun(); // other.node.parent.getComponent('HeroControl').EnableHeroMoving(false); } }, onCollisionStay: function (other) { // console.log('on collision stay'); }, onCollisionExit: function (other) { } });