【发布时间】:2015-10-27 08:53:10
【问题描述】:
我觉得不得不发布这个真的很愚蠢,但我已经努力了整整一个星期,但我一无所获!
我正在尝试创建一个高分板。前 10 个分数,保存到一个 INI 文件中。我曾经在整个互联网上搜索过每一件事。我就是不明白。
所以我尝试的是这个......
我有一个“load_room”设置。当这个房间加载时,它会运行以下代码:
ini_open('score.ini')
ini_write_real("Save","highscore_value(1)",highscore_value(1));
ini_write_string("Save","highscore_name(1)",highscore_name(1));
ini_close();
room_goto(room0);
然后当我的角色死亡时:
myName = get_string("Enter your name for the highscore list: ","Player1"); //if they enter nothing, "Player1" will get put on the list
highscore_add(myName,score);
ini_open('score.ini')
value1=ini_write_real("Save","highscore_value(1)",0);
name1=ini_write_string("Save","highscore_name(1)","n/a");
ini_close();
highscore_clear();
highscore_add(myName,score);
score = 0;
game_restart();
我不担心包含显示分数的代码,因为我正在检查游戏为实际添加的值创建的 score.ini。
有了这个,我似乎能够保存一个分数,仅此而已。我需要保存 10 个。再次,我很抱歉问了同样古老的问题,但我真的需要帮助,希望有人能提供帮助!
非常感谢, 李。
【问题讨论】:
-
我想你混淆了
ini_write_real和ini_read_real。 -
对于任何访问此页面的人,让我指出,有一些扩展可以创建在线高分系统,让玩家可以看到其他玩家的高分。有点酷。见google.com/…
标签: game-maker