小游戏(四)

添加主角碰触收集星星的行为 打开 Game 脚本,在 spawnNewStar 方法最后面添加一句 newStar.getComponent(‘Star’).game = this; // Game.js spawnNewStar: function() { // … // 在星星组件上暂存 Game 对象的引用 newStar.getComponent(‘Star’).game = this;
相关文章
相关标签/搜索