Exemplo n.º 1
0
        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();
        }
Exemplo n.º 2
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(
                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);
        }
Exemplo n.º 3
0
 private Animation(Animation animation)
 {
     this.frames = animation.frames;
     FramesPerSecond = 5;
 }
Exemplo n.º 4
0
        public object Clone()
        {
            Animation animationClone = new Animation(this);

            animationClone.frameWidth = this.frameWidth;
            animationClone.frameHeight = this.frameHeight;
            animationClone.Reset();

            return animationClone;
        }
Exemplo n.º 5
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);
        }
Exemplo n.º 6
0
        private void ShootProjectile(Vector2 direction)
        {
            var animations = new Dictionary<AnimationKey, Animation>();

            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);

            switch (_projectileType)
            {
                case 1:
                    ShootFireball(direction, animations);
                    break;
                case 2:
                    ShootMeteor(direction, animations);
                    break;
            }
        }
Exemplo n.º 7
0
        public object Clone()
        {
            var animationClone = new Animation(this);

            animationClone.FrameWidth = FrameWidth;
            animationClone.FrameHeight = FrameHeight;
            animationClone.Reset();

            return animationClone;
        }
Exemplo n.º 8
0
 private Animation(Animation animation)
 {
     _frames = animation._frames;
     FramesPerSecond = 15;
 }