我java中毒太深,js沒學到家,求指教
uj5u.com熱心網友回復:
this.sheep2 這個節點 有掛上NewScript.js 這個腳本嗎 ?如果有 試試看 this.sheep2.getComponent(''NewScript).setj(2);
uj5u.com熱心網友回復:
getComponent('NewScript')不要加.js后綴uj5u.com熱心網友回復:
看我博客 https://blog.csdn.net/S_clifftop/article/details/94456992uj5u.com熱心網友回復:
NewScripts.js里的使用module.exports或者ccclass的寫法,然后在需要使用的模塊或者類(檔案)里var xxx=require('/NewScripts');例如,在NewScripts.js里代碼:
module.exports={
name:'qq_45330885'
}
那么在使用的地方:
var SomeOne=require(''./NewScripts');
cc.log(SomeOne.name);
//希望能幫到你
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/25694.html
標籤:Cocos2d-x
上一篇:新手求救 跪求
下一篇:audioclip問題求助
