| | |
| | | |
| | | export default class Player { |
| | | |
| | | constructor(dom, dark, didClickSprite) { |
| | | constructor(dom, dark) { |
| | | // not dynamic |
| | | this.darkModel = dark; |
| | | this.didClickSprite = didClickSprite; |
| | | // init |
| | | this.app = generatePixiApp(dark); |
| | | dom.appendChild(this.app.view); |
| | |
| | | } |
| | | |
| | | const handleMouseMove = (event) => { |
| | | if (isSelecting && !this.didClickSprite) { |
| | | if (isSelecting) { |
| | | // select end pos |
| | | const endPoint = new PIXI.Point(); |
| | | this.app.renderer.events.mapPositionToPoint(endPoint, event.clientX, event.clientY); |
| | |
| | | x: this.app.renderer.width / 2 - centerPoint.x * this.scale, |
| | | y: this.app.renderer.height / 2 - centerPoint.y * this.scale |
| | | }, 200).start(); |
| | | } |
| | | |
| | | updateDidClickSprite = (value) => { |
| | | this.didClickSprite = value; |
| | | } |
| | | |
| | | getStartedTicker = () => { |