我正在制作一个涂鸦跳跃游戏,现在我陷入了困境。一旦他接触到硬币,玩家就会获得分数,我想获得一个高分,所以当它重新开始时,或者当你点击主菜单时,会有一个文字说出高级的scoe和你的分数。我已经发了文。请求帮助我!
Traceback (most recent call last):
File "/opt/adagios/adagios/views.py", line 43, in wrapper
result = view_func(request, *args, **kwargs)
File "/opt/adagios/adagios/objectbrowser/views.py", line 191, in edit_object
c['form'] = PynagForm(pynag_object=my_object, initial=my_object._original_attributes)
File "/opt/adagios/adagios/objectbrowser/forms.py", line 312, in __init__
self.fields[field_name] = self.get_pynagField(field_name, css_tag="inherited")
File "/opt/adagios/adagios/objectbrowser/forms.py", line 418, in get_pynagField
_('%(inherited_value)s (inherited from template)') % {'inherited_value': smart_str(inherited_value)}
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 54: ordinal not in range(128)
以下是代码现在的一些屏幕! https://www.dropbox.com/s/90mf2esf4tqe7xh/Capture.PNG?dl=0 这里是需要展示高分的地方! 请帮帮我!
答案 0 :(得分:1)
请在此处提出问题之前尝试使用Google ...
(StackExchange规则:不要问你没有尝试寻找答案的问题) - 例如http://answers.unity3d.com/questions/672869/player-prefs-to-store-high-scores.html
如果您的实际问题是如何保存高分,请使用PlayerPrefs
。
例如,要为以后保存高分(每次达到新分数时,例如在游戏结束时):
if(score > PlayerPrefs.GetInt("HighScore", 0)) {
PlayerPrefs.SetInt("HighScore", score);
PlayerPrefs.Save();
}
要阅读它(在主菜单中使用Start()
或Awake()
方法),请
SomeHighScoreUIText.text = PlayerPrefs.GetInt("HighScore", 0);