using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;namespace MyGame
{
    class TurtleMonster
    {
        string monsterNmae;
        //怪物名称
        public string MonsterNmae
        {
            get { return monsterNmae; }
            set { monsterNmae = value; }
        }
        int originalBlood;
        //怪物的生命值
        public int OriginalBlood
        {
            get { return originalBlood; }
            set { originalBlood = value; }
        }
        int attackPower;
        //怪物的攻击力
        public int AttackPower
        {
            get { return attackPower; }
            set { attackPower = value; }
        }
        int defendPower;
        //怪物防御力
        public int DefendPower
        {
            get { return defendPower; }
            set { defendPower = value; }
        }
        Image image;
        //怪物的图片
        public Image Image
        {
            get { return image; }
            set { image = value; }
        }
        Point originalLocation, currentLocation;
        //保存怪物当前位置
        public Point CurrentLocation
        {
            get { return currentLocation; }
            set { currentLocation = value; }
        }
        //保存怪物原始位置
        public Point OriginalLocation
        {
            get { return originalLocation; }
            set { originalLocation = value; }
        }
        Size size;
        //显示怪物大小
        public Size Size
        {
            get { return size; }
            set { size = value; }
        }
        /// <summary>
        /// 怪物移动的方法
        /// </summary>
        /// <param name="hero"></param>
        public void Move(Hero hero)
        {
            this.currentLocation = new Point(hero.OriginalLocation.X, hero.OriginalLocation.Y - hero.Size.Height);
        }
        public void Move()
        {
            this.currentLocation = this.originalLocation;
        }
        public TurtleMonster()
        {
        }
        public TurtleMonster(string name, Image image, Point originalLocation, Size size)
        {
            this.monsterNmae = name;
            this.OriginalBlood = 200;
            this.AttackPower = 50;
            this.DefendPower = 10;
            this.MonsterNmae = name;
            this.Image = image;
            this.OriginalLocation = originalLocation;
            this.CurrentLocation = originalLocation;
            this.Size = size;
        }
       
    }
    public struct StructMonster
    {
        public string HeroName;//怪物名字
        public int OringinalBlood;//原始生命值
        public int AttackPower;//攻击力
        public int DefendPower;//防御力
        public Image Image;//玩家的图片
        public Point OriginalLocation;
        public Point CurrentLocatino;
        public Size Size;//大小
        public void Move(Hero hero)
        {
            this.CurrentLocatino = new Point(hero.OriginalLocation.X, hero.OriginalLocation.Y + hero.Size.Height);
        }
        public void Move()
        {
            this.CurrentLocatino = this.OriginalLocation;
        }
    }
   
}错误 1 可访问性不一致: 参数类型“MyGame.Hero”比方法“MyGame.StructMonster.Move(MyGame.Hero)”的可访问性低 C:\Documents and Settings\Administrator\桌面\C#\MyGame\MyGame\TurtleMonster.cs 104 21 MyGame

解决方案 »

  1.   

    参数用MyGame.getMonsterNmae()
    或者
    string monsterNmae; 前加public
      

  2.   

    请检查MyGame.Hero类的访问限制性关键字是什么?如果没写,默认是private,建议改成internal
    或者public关于访问限定符的说明:public 
     访问不受限制。
     
    protected 
     访问仅限于包含类或从包含类派生的类型。
     
    internal 
     访问仅限于当前程序集。
     
    protected internal
     访问仅限于从包含类派生的当前程序集或类型。
     
    private 
     访问仅限于包含类型。
     
      

  3.   

    class TurtleMonster 改为:public class TurtleMonster 
    再检查你其他的类,是否有public 修饰符