Objective-c 中回合之间的积分帮助
我是 Objective-C 的新手,无法找到一种方法来为游戏中的多个玩家存储积分。 我的游戏中有 4 个角色,它们都是同一类的对象。 1个由用户控制,另外3个由计算机控制。 我的游戏中的每个级别都包含 3 场比赛。 我需要一种方法来跟踪每个角色每轮的完成位置,以便在 3 场比赛结束时,我可以根据用户进入的位置向他们奖励积分。任何人都可以提供建议吗? NSDictionary 能完成这个任务吗? 我对 NSDictionary 有一个非常粗略的了解,但不确定是否可以过滤掉每个玩家的数据以获取他们的数据。 在我看来,我认为我需要在某个地方存储这些数据,这样我就可以获得他们的平均成绩,以便与其他玩家进行比较。
I am new to objective-c and am having trouble figuring out a way to store points for multiple players in my game. I have 4 characters in my game that are all objects from the same class. 1 is controlled by the user and the other 3 are controlled by the computer. Each level in my game consists of 3 races. I need a way to keep track of each characters finish place for each round so that at the end of the 3 races, I can award points to the user depending on which place they came in. Can anyone offer a suggestion? Would a NSDictionary accomplish this? I kind of have a very rough understanding of NSDictionary but wasn't sure if I could filter out each player's data to get just their data. In my mind, I think I need somewhere to store this data so then I can get the average of their finishes to compare to the other players.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
为什么不简单地定义一个数组来保存每个级别的玩家分数作为 Player 类的实例变量? 例如:
why wouldn't you simply define an array which holds the players score for each level as an instance variable of the Player class? So for example: