I'm creating an app that deals with converting seconds into minutes, for Pikmin 3's Mission Mode.
Basically, I take a score, subtract the default score of a level then divide by 30 points per second to get the time remaining in seconds.
Ex: The top score for the "Tropical Forest" level is 8800. It's The level's default score is 2110. 8800 - 2110 is 6690. 6690 divided by 30 points per second is 223 seconds, which turns out to be 3 minutes and 43 seconds.
I cannot seem to convert 223 to 3 minutes and 43 seconds. Below is my code.
Thanks for the help!
Basically, I take a score, subtract the default score of a level then divide by 30 points per second to get the time remaining in seconds.
Ex: The top score for the "Tropical Forest" level is 8800. It's The level's default score is 2110. 8800 - 2110 is 6690. 6690 divided by 30 points per second is 223 seconds, which turns out to be 3 minutes and 43 seconds.
I cannot seem to convert 223 to 3 minutes and 43 seconds. Below is my code.
B4X:
Sub CalculateTime (Score As String, Level As String)
'Declares neccessary components.
Dim TimeBonus As String
Dim FinalScore As String
Dim BeatIn As String
If Score = "" Then
Msgbox ("Please enter a score!", "Error: Empty Score")
Log("Empty Score Detected")
Else If Level = "" Then
Msgbox ("Please select a level!", "Error: Empty Level")
Log("No Level Selected")
End If
If Level = "Tropical Forest" Then
If Score < 2110 Then
Msgbox ("Score is too low", "Score Error")
Log("Too low of a score detected")
Else
FinalScore = Score - 2110
TimeBonus = FinalScore / 30
BeatIn = TimeBonus / 60
If TimeBonus Mod 60 > 0 Then
BeatIn = BeatIn + 1
Msgbox (BeatIn, "Beat Tropical Forest In")
End If
Log("Calculated time needed to beat level")
End If
End If
End Sub
Thanks for the help!