コード例 #1
0
        private void CreatePlayer()
        {
            Dictionary<AnimationKey, Animation> animations = new Dictionary<AnimationKey, Animation>();

            Animation animation = new Animation(3, 32, 32, 0, 0);
            animations.Add(AnimationKey.Down, animation);

            animation = new Animation(3, 32, 32, 0, 32);
            animations.Add(AnimationKey.Left, animation);

            animation = new Animation(3, 32, 32, 0, 64);
            animations.Add(AnimationKey.Right, animation);

            animation = new Animation(3, 32, 32, 0, 96);
            animations.Add(AnimationKey.Up, animation);

            AnimatedSprite sprite = new AnimatedSprite(
                characterImages[genderSelector.SelectedIndex, classSelector.SelectedIndex],
                animations);
            EntityGender gender = EntityGender.Male;

            if (genderSelector.SelectedIndex == 1)
                gender = EntityGender.Female;

            Entity entity = new Entity(
                "Pat",
                DataManager.EntityData[classSelector.SelectedItem],
                gender,
                EntityType.Character);

            foreach (string s in DataManager.SkillData.Keys)
            {
                Skill skill = Skill.FromSkillData(DataManager.SkillData[s]);
                entity.Skills.Add(s, skill);
            }

            Character character = new Character(entity, sprite);

            GamePlayScreen.Player = new Player(GameRef, character);
        }
コード例 #2
0
ファイル: LoadGameScreen.cs プロジェクト: brollins90/eotd
        private void CreatePlayer()
        {
            Dictionary<AnimationKey, Animation> animations = new Dictionary<AnimationKey, Animation>();

            Animation animation = new Animation(3, 32, 32, 0, 0);
            animations.Add(AnimationKey.Down, animation);

            animation = new Animation(3, 32, 32, 0, 32);
            animations.Add(AnimationKey.Left, animation);

            animation = new Animation(3, 32, 32, 0, 64);
            animations.Add(AnimationKey.Right, animation);

            animation = new Animation(3, 32, 32, 0, 96);
            animations.Add(AnimationKey.Up, animation);

            AnimatedSprite sprite = new AnimatedSprite(
                GameRef.Content.Load<Texture2D>(@"PlayerSprites\malefighter"),
                animations);

            Entity entity = new Entity(
                "Encelwyn",
                DataManager.EntityData["Fighter"],
                EntityGender.Male,
                EntityType.Character);

            Character character = new Character(entity, sprite);
            GamePlayScreen.Player = new Player(GameRef, character);
        }
コード例 #3
0
ファイル: Character.cs プロジェクト: Nanuq/DragonSlice
 public Character(Entity entity, AnimatedSprite sprite)
 {
     this.entity = entity;
     this.sprite = sprite;
 }
コード例 #4
0
ファイル: Camera.cs プロジェクト: Nanuq/DragonSlice
 public void LockToSprite(AnimatedSprite sprite)
 {
     position.X = (sprite.Position.X + sprite.Width / 2) * zoom
         - (viewportRectangle.Width / 2);
     position.Y = (sprite.Position.Y + sprite.Height / 2) * zoom
         - (viewportRectangle.Height / 2);
     LockCamera();
 }
コード例 #5
0
ファイル: NonPlayerCharacter.cs プロジェクト: brollins90/eotd
 public NonPlayerCharacter(Entity entity, AnimatedSprite sprite)
     : base(entity, sprite)
 {
     conversations = new List<Conversation>();
     quests = new List<Quest>();
 }
コード例 #6
0
ファイル: Character.cs プロジェクト: Jake4288/DC
 public Character(AnimatedSprite sprite, int hp, int damage)
 {
     this.sprite = sprite;
     Hp = hp;
     Damage = damage;
 }
コード例 #7
0
ファイル: GamePlayScreen.cs プロジェクト: Jake4288/DC
        protected override void LoadContent()
        {
            var animations = new Dictionary<AnimationKey, Animation>();
            _enemies = new List<Enemy>();

            var animation = new Animation(3, 32, 32, 0, 0);
            animations.Add(AnimationKey.Down, animation);

            animation = new Animation(3, 32, 32, 0, 32);
            animations.Add(AnimationKey.Left, animation);

            animation = new Animation(3, 32, 32, 0, 64);
            animations.Add(AnimationKey.Right, animation);

            animation = new Animation(3, 32, 32, 0, 96);
            animations.Add(AnimationKey.Up, animation);

            var sprite = new AnimatedSprite(@"PlayerSprites\malepriest", animations, 200.0f, 1.5f);
            var enemsprite = new AnimatedSprite(@"PlayerSprites\femalepriest", animations, 100.0f, 2.0f);
            var enemsprite2 = new AnimatedSprite(@"PlayerSprites\femalefighter", animations, 50.0f, 2.0f);

            sprite.Position = new Vector2(300, 300);
            enemsprite2.Position = new Vector2(0, 500);

            var character = new Character(sprite, 40, 1);
            var enemcharacter1 = new Character(enemsprite, 20, 10);
            var enemcharacter2 = new Character(enemsprite2, 30, 50);

            _player = new Player(GameRef, character);
            _enemies.Add(new Enemy(GameRef, enemcharacter1, _player));
            _enemies.Add(new Enemy(GameRef, enemcharacter2, _player));

            _player.LoadContent(GameRef.Content);
            foreach (var enemy in _enemies)
                enemy.LoadContent(GameRef.Content);

            _collisionHandler = new CollisionHandler(GameRef, _player, _enemies);

            base.LoadContent();
        }