| 390 | console.log(this.STEP, this.DURATION); |
| 391 | } |
| 392 | run() { |
| 393 | const perX = this.puzzleX / this.STEP; |
| 394 | const perDuration = this.DURATION / this.STEP; |
| 395 | const firstPos = [this.x - parseInt(Math.random() * 6, 10), this.y + parseInt(Math.random() * 11, 10), this.t]; |
| 396 | this.pos.unshift(firstPos); |
| 397 | this.stepPos(perX, perDuration); |
| 398 | this.fixPos(); |
| 399 | const reactTime = parseInt(60 + Math.random() * 100, 10); |
| 400 | const lastIdx = this.pos.length - 1; |
| 401 | const lastPos = [this.pos[lastIdx][0], this.pos[lastIdx][1], this.pos[lastIdx][2] + reactTime]; |
| 402 | this.pos.push(lastPos); |
| 403 | return this.pos; |
| 404 | } |
| 405 | stepPos(x, duration) { |
| 406 | let n = 0; |
| 407 | const sqrt2 = Math.sqrt(2); |