423行的代码里 isOnPicturePos(x = TouchInput.x, y = TouchInput.y) { const pic = this._picture; if (!pic.bitmap || !pic.bitmap.isReady() || pic.scale.x === 0 || pic.scale.y === 0) { return false; } if (this.isTouchPosInFrameWindow()) { return true; } const dx = this.getTouchScreenX(x) - pic.x; const dy = this.getTouchScreenY(y) - pic.y; const sin = Math.sin(-pic.rotation); const cos = Math.cos(-pic.rotation); const bx = Math.floor(dx * cos + dy * -sin) / pic.scale.x + pic.anchor.x * pic.width; const by = Math.floor(dx * sin + dy * cos) / pic.scale.y + pic.anchor.y * pic.height; return pic.bitmap.getAlphaPixel(bx, by) !== 0; } 它贴心帮你判定了,点击处不为透明像素才算成功点击 |
站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作
GMT+8, 2025-1-11 22:36
Powered by Discuz! X3.1
© 2001-2013 Comsenz Inc.