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

Method stepPos

jd_validate.js:356–374  ·  view source on GitHub ↗
(x, duration)

Source from the content-addressed store, hash-verified

354 }
355
356 stepPos(x, duration) {
357 let n = 0;
358 const sqrt2 = Math.sqrt(2);
359 for (let i = 1; i <= this.STEP; i++) {
360 n += 1 / i;
361 }
362 for (let i = 0; i < this.STEP; i++) {
363 x = this.puzzleX / (n * (i + 1));
364 const currX = parseInt((Math.random() * 30 - 15) + x, 10);
365 const currY = parseInt(Math.random() * 7 - 3, 10);
366 const currDuration = parseInt((Math.random() * 0.4 + 0.8) * duration, 10);
367
368 this.moveToAndCollect({
369 x: currX,
370 y: currY,
371 duration: currDuration,
372 });
373 }
374 }
375
376 fixPos() {
377 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