Skip to main content
edited tags
Link
Kevin Reid
  • 5.7k
  • 22
  • 30
removed tag from title and cleaned up sign-off
Source Link
House
  • 73.5k
  • 17
  • 188
  • 276

XNA - Inconsistent accessibility: parameter type is less accessible than method

Inconsistent accessibility: parameter type 'Space_Game.Level' is less accessible than method 'Space_Game.GameObject.Shoot(Space_Game.Level, string)'

Inconsistent accessibility: parameter type 'Space_Game.Level' is less accessible than method 'Space_Game.GameObject.Shoot(Space_Game.Level, string)'

Thanks in Advance,

Mark Dijkema

XNA - Inconsistent accessibility: parameter type is less accessible than method

Inconsistent accessibility: parameter type 'Space_Game.Level' is less accessible than method 'Space_Game.GameObject.Shoot(Space_Game.Level, string)'

Thanks in Advance,

Mark Dijkema

Inconsistent accessibility: parameter type is less accessible than method

Inconsistent accessibility: parameter type 'Space_Game.Level' is less accessible than method 'Space_Game.GameObject.Shoot(Space_Game.Level, string)'

Source Link
DijkeMark
  • 117
  • 1
  • 7

XNA - Inconsistent accessibility: parameter type is less accessible than method

I have a level class in which I make a new turret. I give the turret the level class as parameter. So far so good. Then in the Update function of the Turret I call a function Shoot(), which has that level parameter it got at the moment I created it.

But from that moment it gives the following error:

Inconsistent accessibility: parameter type 'Space_Game.Level' is less accessible than method 'Space_Game.GameObject.Shoot(Space_Game.Level, string)'

All I know it has something to do with not thr right protection level or something like that.

The level class:

    public Level(Game game, Viewport viewport)
    {
        _game = game;
        _viewport = viewport;
        _turret = new Turret(_game, "blue", this);
        _turret.SetPosition((_viewport.Width / 2).ToString(), (_viewport.Height / 2).ToString());
    }

The Turret Class:

        public Turret(Game game, String team, Level level)
        :base(game)
    {
        _team = team;
        _level = level;

        switch (_team)
        {
            case "blue":
                _texture = LoadResources._blue_turret.Texture;
                _rows = LoadResources._blue_turret.Rows;
                _columns = LoadResources._blue_turret.Columns;
                _maxFrameCounter = 10;
                break;
            default:
                break;
        }

        _frameCounter = 0;
        _currentFrame = 0;
        _currentFrameMultiplier = 1;
    }

    public override void Update()
    {
        base.Update();

        SetRotation();
        Shoot(_level, "turret");
    }

The Shoot Function (Which is in GameObject class. The Turret Class inherited the GameObject Class. (Am I saying that right?)):

protected void Shoot(Level level, String type)
    {
        MouseState mouse = Mouse.GetState();
        if (mouse.LeftButton == ButtonState.Pressed)
        {
            switch (_team)
            {
                case "blue":
                    switch (type)
                    {
                        case "turret":
                            TurretBullet _turretBullet = new TurretBullet(_game, _team);
                            level.AddProjectile(_turretBullet);
                            break;
                        default:
                            break;
                    }
                    break;
                default:
                    break;
            }
        }
    }

Thanks in Advance,

Mark Dijkema