- Home /
Letter Ranking System, Checking Higher Rank
Alright so my game right now assigns a rank when you complete each level that is C, B, A, or S
my problem is when i save the rank, i want to only save it if it's higher than the previously saved rank (e.g. don't save rank A if S is already saved)
the only ways i can think of seem messy and would require big if/switch statements
with how im using the rank elsewhere i cannot change the ranks to numbers, i must leave them letters
i could save ANOTHER rank thats a number alongside the letter ranking but this seems messy too
any ideas? thanks
Answer by Kiloblargh · Feb 04, 2014 at 07:45 PM
Something like
rankToSave = ( System.BitConverter.ToInt32 (System.Text.ASCIIEncoding.GetBytes ((newRank), 0) % 70) < ( System.BitConverter.ToInt32 (System.Text.ASCIIEncoding.GetBytes ((oldRank), 0) % 70 ) ? newRank : oldRank;
(not tested)
should do it in one line. That's a ridiculous hack, but so is your whole letter based ranking system in the first place, so...
haha thanks for the effort but i cannot use something i dont even half understand XD
i guess im probably going to have to just save another rank i dont display that is 0-3 for C-S
Your answer
Follow this Question
Related Questions
Scoring help ! 1 Answer
I want to keep coins and score after player`s death, and also to have high score 1 Answer
HighScore doesn't work 1 Answer
Score Not Adding Up..? 1 Answer
How to save score for survival time? 1 Answer