예제 #1
0
        public Player(ContentManager Content, World world)
        {
            playerSprite = new AnimatedSprite(Content, "player", Width, Height);
            playerMeleeAttackSprite = new AnimatedSprite(Content, "player", Width*2, Height*2, new Vector2(Width, Height + (Height/2)));

            this.world = world;
            pathfinder = new Pathfinder(world);
            damageFont = Content.Load<SpriteFont>(@"Fonts/Font-8bitoperator JVE");
            debugRec = Content.Load<Texture2D>(@"debugRec");
        }
예제 #2
0
        /// <summary>
        /// defualt constructer
        /// </summary>
        /// <param name="tilePosition">starting position of the npc</param>
        /// <param name="name">a name for the pc</param>
        /// <param name="textureName">name of the content this NPC will use</param>
        /// <param name="npcHeight">height in pixels</param>
        /// <param name="npcWidth">width in pixels</param>
        public NPC(ContentManager Content, World world, Vector2 position, string name, string textureName, int npcHeight, int npcWidth)
        {
            npcData.Name = name;
            npcData.NpcHeight = npcHeight;
            npcData.NpcWidth = npcWidth;
            npcData.Position = position;
            npcData.OriginalPosition = npcData.Position;
            npcData.PixelPosition = npcData.Position * 32;
            npcData.visiblityRange = 300;
            npcData.speed = 30;
            npcData.Direction.X = 1;

            npcData.maxHP = 10;

            NpcSprite = new AnimatedSprite(Content, textureName, npcHeight, npcWidth);
            fontTiny = Content.Load<SpriteFont>(@"Fonts/Font-PF Arma Five");
            damageFont = Content.Load<SpriteFont>(@"Fonts/Font-8bitoperator JVE");
            pathfinder = new Pathfinder(world);
            this.world = world;
            cellPath = new List<Cell>();

            randomStep = rand.Next(-15, 15);
            randomSpeed = rand.Next(0, 5);

            debugRec = Content.Load<Texture2D>(@"debugRec");
        }