小编Bry*_*yan的帖子

我的Levels课程有些困难.怎么了?

我写了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();   
    } …
Run Code Online (Sandbox Code Playgroud)

c# xna

0
推荐指数
1
解决办法
108
查看次数

标签 统计

c# ×1

xna ×1