MCPcopy Create free account
hub / github.com/Semporia/Scripts / stepPos

Method stepPos

JDJRValidator_Pure.js:426–444  ·  view source on GitHub ↗
(x, duration)

Source from the content-addressed store, hash-verified

424 }
425
426 stepPos(x, duration) {
427 let n = 0;
428 const sqrt2 = Math.sqrt(2);
429 for (let i = 1; i <= this.STEP; i++) {
430 n += 1 / i;
431 }
432 for (let i = 0; i < this.STEP; i++) {
433 x = this.puzzleX / (n * (i + 1));
434 const currX = parseInt((Math.random() * 30 - 15) + x, 10);
435 const currY = parseInt(Math.random() * 7 - 3, 10);
436 const currDuration = parseInt((Math.random() * 0.4 + 0.8) * duration, 10);
437
438 this.moveToAndCollect({
439 x: currX,
440 y: currY,
441 duration: currDuration,
442 });
443 }
444 }
445
446 fixPos() {
447 const actualX = this.pos[this.pos.length - 1][0] - this.pos[1][0];

Callers 1

runMethod · 0.95

Calls 1

moveToAndCollectMethod · 0.95

Tested by

no test coverage detected