0
我目前做的一个小游戏,我想知道如何使用关键字替换编号的指标,例如Java的索引数组关键字
private boolean keyStroke = new boolean[4];
if(pressing up key) {
keyStroke[0] = true;
}
我想:
private boolean keyStroke = new boolean[4];
if(pressing up key) {
keyStroke[up] = true;
}
我发现这是可能的变量,如int up = 0;但有没有其他方法可以这样做?
我看到他只是需要不断地像枚举 – HungPV