我想将一个文字冒险游戏作为一个学校项目,我想知道如何能够创建和连接游戏位置发生故事
我想过用Location
这样的变量和像
name
int[][] locnow = new int[20][20];
位置位置本身(北,西,东,南点)。
我的主要问题是
感谢您的帮助。
答案 0 :(得分:1)
怎么样:
public class Location {
private int x, y;
private String name;
// getters and setters here
}
结合
public class Game {
private GameTile[][] field;
// getters and setters here
}
public class GameTile {
// some tile-specific information goes here
}
Thay方式,您存储游戏字段特定信息(如果需要,在GameTile
中)。如果您不需要GameTile
类,则可以省略Game
类中的数组,并只存储最大尺寸。
这是如何回答你的问题的:
x += 1
,x -= 1
,