【发布时间】:2016-01-05 18:48:07
【问题描述】:
我正在开发 LibGDX 中的游戏,但我被数组列表困住了。我的计划是有一副 20 张牌。数组列表中的每个位置都有自己的卡片,其中包含统计值。
下面是我的卡片类:
public class Card {
private String name;
private int force;
private int attack;
private int defense;
private int cost;
public Card(String name, int force, int attack, int defense, int cost){
this.name = name;
this.attack = attack;
this.cost = cost;
this.defense = defense;
this.force = force;
}
public int force (){
return this.force;
}
public int attack (){
return this.attack;
}
public int defense (){
return this.defense;
}
public int cost (){
return this.cost;
}
public String name(){
return this.name;
}
}
这是我的套牌类,我需要帮助我了解实现卡片值的代码。
public class Deck {
private Array<Card> cards;
private String name;
private int force;
private int attack;
private int defense;
private int cost;
public Deck(){
cards.size = 20;
}
public void createDeck(){
}
public void shuffle(){
}
public void draw(){
}
public void add(){
}
}
简而言之,我需要帮助遍历阵列列表并将攻击、防御、成本和力量放置到每个阵列位置。任何帮助或建议将不胜感激。
【问题讨论】: