我想了解如何获得用户升级所需的剩余积分

I would like to find out how to get the remaining points a user needs to level up

对不起,我数学很差,而且我也不懂英文,所以我真的不知道怎么问这个问题。

我用它来计算用户级别

const curLevel = Math.floor(0.2 * Math.sqrt(score.points));

我想了解如何获得用户升级所需的剩余积分。我还没有真正尝试任何东西,因为我不知道从哪里开始,甚至可能是超级简单的东西...

您可以通过求解方程 curLevel + 1 = 0.2 * Math.sqrt(nextLevelPoint).
中的点数来计算达到下一个整数级别所需的点数 你知道你可以计算下一个级别所需的总分:

let nextLevelPoint = Math.pow(5*curLevel + 5, 2)

从这个 nextLevelPoint 中减去 score.point,您将得到用户升级所需的剩余点数。