SSVOpenHexagon
SSVOpenHexagon copied to clipboard
Lua function "u_forceIncrement" doesn't actually increment level difficulty
After wanting to make a custom level that increases in difficulty after certain patterns and not on a timer, I tried using the function u_forceIncrement to do it, but the function only calls incrementDifficulty.
incrementDifficulty:
void HexagonGame::incrementDifficulty()
{
playSoundOverride("levelUp.ogg");
const float signMult = (levelStatus.rotationSpeed > 0.f) ? 1.f : -1.f;
levelStatus.rotationSpeed += levelStatus.rotationSpeedInc * signMult;
const auto& rotationSpeedMax(levelStatus.rotationSpeedMax);
if(std::abs(levelStatus.rotationSpeed) > rotationSpeedMax)
{
levelStatus.rotationSpeed = rotationSpeedMax * signMult;
}
levelStatus.rotationSpeed *= -1.f;
status.fastSpin = levelStatus.fastSpin;
}
This sounds correct on paper by the function names, but after looking into the functions "incrementDifficulty" only plays the level up sound and updates the rotation speed. It does not update the level speed, sides and does not increase the level increments value nor does it end up firing the onIncrement event.
My expected behavior would have been closer to the updateIncrement function:
updateIncrement:
void HexagonGame::updateIncrement()
{
if(!levelStatus.incEnabled)
{
return;
}
if(status.getIncrementTimeSeconds() < levelStatus.incTime)
{
return;
}
++levelStatus.currentIncrements;
incrementDifficulty();
status.resetIncrementTime();
mustChangeSides = true;
}
So my suggestion would be to add a special forceIncrement function, or change the way incrementDifficuly is implemented.
Example for forceIncrement:
void HexagonGame::forceIncrement(bool mResetTimer)
{
++levelStatus.currentIncrements;
incrementDifficulty();
if (mResetTimer) {
status.resetIncrementTime();
}
mustChangeSides = true;
}