各レベルの敵の数を格納する Levels クラスを作成しました。Levels クラスは、新しいレベルを開始する前に一度呼び出されます。たとえば、プレイヤーがゲーム メニューでレベル 1 を選択した場合、5 つのゾンビ、3 つのクモ、1 つの狼男が (別のクラスで) 描画されます。しかし、今のところ、常に次のエラー メッセージが表示されます。メソッドには戻り値の型が必要です。
なにが問題ですか ?
public class Levels
{
int currentLevel, Zombies, Spiders, Werewolfs;
public Levels(int Level)
{
this.currentLevel = Level;
}
public Level1()
{
Zombies = 5;
Spiders = 3;
Werewolfs = 1;
}
public Level2()
{
Zombies = 8;
Spiders = 4;
Werewolfs = 2;
}
public Level3()
{
Zombies = 12;
Spiders = 4;
Werewolfs = 3;
}
public void Load(ContentManager content)
{
if (currentLevel == 1)
Level1();
if (currentLevel == 2)
Level2();
if (currentLevel == 3)
Level3();
}
}