Closed FrostyNick closed 12 months ago
I am currently investigating the issue ever since the release of v1.5.0. It seems that the equation, for the cop to move, is causing the problem, though I can't recall if it was an issue before v1.5.0. Might have to either rework the equation or revert back to the original equation that was before v1.5.0.
I forgot to mention this doesn't happen on v1.6.1
(added to main post as an edit). It's caused by the different math involved with the synchronization existing in v1.6.2
, and the cubes are no longer guaranteed to be consistently in the range x2[0] <= 530 && x2[0] > 526.5)
. It should be updated to work with the new variable values.
@FrostyNick What do you have in mind? Is it simply changing the values accordingly for x2[0] <= 530 && x2[0] > 526.5)?
It doesn't seem that simple, since the numbers are variable. For example, if the red boxes froze for 2 seconds due to lag, then in the next frame, all the boxes would move many pixels to the same location to sync to where the music is. These values could be skipped. That's v1.6.2 in a nutshell.. red boxes are calculated quite differently.
Maybe it should check if the box behind the beat (-x from white area) has reached it, and it does, point to the previous box, check again until it collides to the white area, repeat. That's my thoughts so far.
Maybe I misread the comment. Yeah, it's based on x2[0] .. just checking for bounds on one number instead of two now and the pointer to the previous cube should take care of the lock in theory.
This code seems to fix the problem. It aims at lockPattern = true
during only one frame of the cubes cycling.
Before:
if(x2[0] <= 530 && x2[0] > 526.5 && !lockPattern){
enemyMovePattern = (enemyMovePattern+1)%8;
if(enemyMovePattern == 0){
enemyMovePattern = 8;
}
lockPattern = true;
}else{
lockPattern = false;
}
After:
// Below line should be next to lockPattern or a global variable in general.
let lockPatternUsed = false; //!!! In reset enemies
// ...
// ...
if (lockPattern) {
lockPattern = false;
lockPatternUsed = true;
}else if(x2[0] <= 526.5) {
lockPattern = false;
lockPatternUsed = false;
}else if(!lockPatternUsed && (x2[0] > 526.5)) {
enemyMovePattern = (enemyMovePattern+1)%8;
if(enemyMovePattern == 0){
enemyMovePattern = 8;
}
lockPattern = true; // only should be true once per red cube cycle
}
@FrostyNick Looks great! If you can, can you make a PR of your solution?
Yes. I revert what I said earlier about one bound instead of two. Somehow I forgot it depends on blue cube? Code is improved in PR.
@FrostyNick Looks great! If you can, can you make a PR of your solution?
Describe the bug Cops randomly stand still, skip one space, and sometimes skip two spaces. Reproducible on
v1.6.2
andv1.6.3
. Not reproducible onv1.6.1
.To Reproduce Steps to reproduce the behavior:
v1.6.3
orv1.6.2
orv1.6.1
.git checkout 0fe9b0a
(v1.6.3);git checkout bc710db
(v1.6.2);git checkout 45b72b0
(v1.6.1), then start a live server or web server.git checkout main
to return to the main branch or return to your branch if you are working on another branch; especially if you have a git stash.Expected behavior Cops are supposed to be moving one tile at a time; not at random intervals.
Desktop (please complete the following information):
Additional context