# guaguale **Repository Path**: wolfdong7/guaguale ## Basic Information - **Project Name**: guaguale - **Description**: cocos creator 刮刮乐 - **Primary Language**: TypeScript - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 3 - **Forks**: 3 - **Created**: 2018-10-19 - **Last Updated**: 2021-04-30 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README ``` const {ccclass, property} = cc._decorator; @ccclass export default class NewClass extends cc.Component { // LIFE-CYCLE CALLBACKS: mask:any = null; onLoad () { this.mask = this.node.getChildByName('mask').getComponent(cc.Mask); this.node.on(cc.Node.EventType.TOUCH_START,function (e){ console.log('touch start'); this.commonFunc(e) },this); this.node.on(cc.Node.EventType.TOUCH_MOVE,(e)=>{ console.log('touch move'); this.commonFunc(e) },this); } start () { } commonFunc (event){ var point = event.touch.getLocation(); point = this.node.convertToNodeSpaceAR(point); this._addCircle(point); } _addCircle(point) { var graphics = this.mask._graphics; console.log("xxxx:",graphics) var color = cc.color(0, 0, 0, 255); graphics.rect(point.x,point.y,50,30) graphics.lineWidth = 2 graphics.fillColor = color //graphics.strokeColor = color graphics.fill() } // update (dt) {} } ``` ![1539951863361.gif](https://upload-images.jianshu.io/upload_images/7527152-24a2076319032b05.gif?imageMogr2/auto-orient/strip)