制作游戏代码game.js,获取点击事件,发射子弹
cc.Class({
extends: cc.Component,
properties: {
player: { type:cc.Node, default:null},
ground: {type:cc.Node,default:null},
aa: { type:cc.Prefab, default:null},
bb:{type:cc.Prefab, default:null},
score:{ type:cc.Label, default:null},
bullet_Num: 0,
bullet_Speed : 0,
},
mouse (){
this.node.on(cc.Node.EventType.TOUCH_START,function(event){
var touch =event.getTouches()[0];
var position = touch.getLocation();
var localPosition = this.node.convertToNodeSpaceAR(position);
this.shutboot(localPosition);
},
this
);
},
newgoal(){
if(this.gg!=null){
this.gg.destroy();
}
va