I got the code that calculates the minutes and seconds needed to beat a level working.. However, the scoring formula is Score - Level Score / 60.
I have the levels and their scores stored in a type, and then put into a list. I am unsure of how to access the appropriate score for the selected level.
This is the code I tried using:
For reference, the following is the code that I use to insert the Types into the lists:
So basically, if the selected level is "The Rustyard", then I want to set The Rustyard's score (1950) as the DefaultScore.
Note this is a open source app. (https://github.com/WhiteholeSoftware/Mission-Mode-Calculator)
I have the levels and their scores stored in a type, and then put into a list. I am unsure of how to access the appropriate score for the selected level.
This is the code I tried using:
B4X:
Sub CalculateTime (Score As String, Level As String)
If Level = TreasureLevels.IndexOf(Level) Then
DefaultScore = TreasureScores.IndexOf(DefaultScore)
End If
End Sub
For reference, the following is the code that I use to insert the Types into the lists:
B4X:
TreasureLevels.Initialize
For ct = 0 To Collect.Length - 1
TreasureLevels.Add(Collect(ct).Name)
Next
TreasureScores.Initialize
For ts = 0 To Collect.Length - 1
TreasureScores.Add(Collect(ts).Score)
Next
B4X:
Collect(0).Name = "Tropical Forest"
Collect(0).Score = 2110
Collect(1).Name = "Silver Lake"
Collect(1).Score = 2920
Collect(2).Name = "Thirsty Desert"
Collect(2).Score = 3340
Collect(3).Name = "Twilight Hollow"
Collect(3).Score = 3240
Collect(4).Name = "Shaded Garden"
Collect(4).Score = 3180
Collect(5).Name = "Tropical Forest Remix"
Collect(5).Score = 1810
Collect(6).Name = "Silver Lake Remix"
Collect(6).Score = 3000
Collect(7).Name = "Thirsty Desert Remix"
Collect(7).Score = 5125
Collect(8).Name = "Twilight Hollow Remix"
Collect(8).Score = 3300
Collect(9).Name = "Shaded Garden Remix"
Collect(9).Score = 2400
Collect(10).Name = "Fortress of Festivity"
Collect(10).Score = 5900
Collect(11).Name = "The Rustyard"
Collect(11).Score = 1950
Collect(12).Name = "Beastly Cavern"
Collect(12).Score = 3500
Collect(13).Name = "Forgotten Cove"
Collect(13).Score = 3480
Collect(14).Name = "Clockwork Chasm"
Collect(14).Score = 2185
So basically, if the selected level is "The Rustyard", then I want to set The Rustyard's score (1950) as the DefaultScore.
Note this is a open source app. (https://github.com/WhiteholeSoftware/Mission-Mode-Calculator)