if @listselect.y != 200 && @listselect.y < 200
@listselect.y += inc_y
elsif @listselect.y != 180 && @listselect.y < 180
@listselect.y -= inc_y
end
The green colored part of the condition is useless combined with the purple, as when the y-coordinate is already less than 200, it can't be equal to 200 at the same time anyway. This is not an error though.
However, the turquise colored part is useless for the same reason. If the y-coordinate is already less than 180, this line is never reached since the green/purple condition also results in true. Since you want to reduce the y-coordinate, you probably wanted to check if the y-coordinate is greater than 180 instead.
And why would there be a different target when the sprite moves upwards than when it moves down? If you wanted to add hysteresis for any reason, you would probably have to prevent the sprite from oscillating once it reached y = 200.
@listselect.y += inc_y
elsif @listselect.y != 180 && @listselect.y < 180
@listselect.y -= inc_y
end
The green colored part of the condition is useless combined with the purple, as when the y-coordinate is already less than 200, it can't be equal to 200 at the same time anyway. This is not an error though.
However, the turquise colored part is useless for the same reason. If the y-coordinate is already less than 180, this line is never reached since the green/purple condition also results in true. Since you want to reduce the y-coordinate, you probably wanted to check if the y-coordinate is greater than 180 instead.
And why would there be a different target when the sprite moves upwards than when it moves down? If you wanted to add hysteresis for any reason, you would probably have to prevent the sprite from oscillating once it reached y = 200.