Esempio n. 1
0
 public Tile(Animation animation)
 {
 }
Esempio n. 2
0
        public void Update(Microsoft.Xna.Framework.GameTime gameTime, ArmorPotionFramework.EntityClasses.Enemy enemy)
        {
            bool canAttack = WaitTimer(gameTime);
            if (canAttack && !_isSetUp)
            {
                Vector2 newPosition = new Vector2(enemy.Position.X - enemy.CurrentSprite.Width / 2, enemy.Position.Y - enemy.CurrentSprite.Height / 2);

                Animation animation = new Animation(1, 256, 256, 0, 0);
                _projectile = new AreaOfEffectProjectile(enemy.World, null, ProjectileTarget.Player, EventType.LightningEvent, false, newPosition, _defaultLifetime);
                _projectile.AnimatedSprites.Add("Normal", _sprite.Clone());
                _projectile.DamageAmount = _aoeDamage;

                enemy.World.Projectiles.Add(_projectile);
                _lifetime = _defaultLifetime;
                _isSetUp = true;
                enemy.CurrentSpriteKey = "Walking";
            }
            else if(canAttack && _isSetUp)
            {
                _lifetime -= gameTime.ElapsedGameTime.Milliseconds;
                if (_lifetime < 0)
                {
                    _isSetUp = false;
                    enemy.ActionComplete();
                }
            }
        }
Esempio n. 3
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            SpriteBatch = new SpriteBatch(GraphicsDevice);
            world = new World(this);

            ItemFactory itemFactory = new ItemFactory(world, @"Items");

            EnemyFactory factory = new EnemyFactory(world, @"Enemy");
            world.EnemyFactory = factory;

            Map dungeonOne = MapLoader.Load("Content/Maps/DungeonOne_top.txt", "Content/Maps/DungeonOne_bottom.txt", "Content/Maps/DungeonOne_enemy.txt", world);
            world.CurrentDungeon = dungeonOne;

            Item item = itemFactory.Create("Super Awesome Potion");
            item.Position = new Vector2(70, 70);
            world.item = item;

            Animation animation = new Animation(1, 32, 32, 0, 0);
            Animation animation2 = new Animation(1, 256, 256, 0, 0);

            AnimatedSprite sprite = new AnimatedSprite(Content.Load<Texture2D>(@"Items\Weapons\Fireball"), new Dictionary<AnimationKey, Animation> { { AnimationKey.Right, animation } });
            AnimatedSprite light = new AnimatedSprite(Content.Load<Texture2D>(@"Enemy\LightBugAttack"), new Dictionary<AnimationKey, Animation> { { AnimationKey.Right, animation2 } });

            world.Player.Inventory.TempaQuips.Add(new Sword(Content.Load<Texture2D>(@"Gui\SwordIcon"), "Sword"));

            world.Player.Inventory.TempaQuips.Add((Gun)itemFactory.Create("Bobs Gun"));
            world.Player.Inventory.SelectRelativeTempaQuip(world.Player, 0);

            world.Player.Inventory.TempaQuips.Add(new Zapper(Content.Load<Texture2D>(@"Gui\GogglesIcon"), "BobsZapper", light));

            world.Player.Inventory.TempaQuips.Add(new SomeConeWeapon(Content.Load<Texture2D>(@"Gui\GravityBootsIcon"), "BobsCone", sprite.Clone()));

            world.Player.Inventory.TempaQuips.Add((EBall)itemFactory.Create("E-Ball Fire"));
            world.Player.Inventory.TempaQuips.Add((EBall)itemFactory.Create("E-Ball Ice"));
            world.Player.Inventory.TempaQuips.Add((EBall)itemFactory.Create("E-Ball Lightning"));
        }
Esempio n. 4
0
 private Animation(Animation animation)
 {
     this._frames = animation._frames;
     FramesPerSecond = 5;
 }
Esempio n. 5
0
        public object Clone()
        {
            Animation animationClone = new Animation(this);

            animationClone._frameWidth = this._frameWidth;
            animationClone._frameHeight = this._frameHeight;
            animationClone.FramesPerSecond = this._framesPerSecond;
            animationClone.Loop = this._loop;
            animationClone.Reset();

            return animationClone;
        }
Esempio n. 6
0
        public Player(World world, Texture2D texture, Texture2D attackTexture)
            : base(world)
        {
            AttackTranslation = new Vector2(-64, -64);
            _currentTranslation = Vector2.Zero;

            int spriteWidth = 128;
            int spriteHeight = 128;
            int frameCount = 4;

            Dictionary<AnimationKey, Animation> animations = new Dictionary<AnimationKey, Animation>();

            Animation animation = new Animation(frameCount, spriteWidth, spriteHeight, 0, 0);
            animations.Add(AnimationKey.Down, animation);

            animation = new Animation(frameCount, spriteWidth, spriteHeight, 0, spriteHeight);
            animations.Add(AnimationKey.Left, animation);

            animation = new Animation(frameCount, spriteWidth, spriteHeight, 0, spriteHeight * 2);
            animations.Add(AnimationKey.Right, animation);

            animation = new Animation(frameCount, spriteWidth, spriteHeight, 0, spriteHeight * 3);
            animations.Add(AnimationKey.Up, animation);

            AnimatedSprite sprite = new AnimatedSprite(
                texture,
                animations,
                Color.White);

            AnimatedSprites.Add("Normal", sprite);

            spriteWidth = 256;
            spriteHeight = 256;

            animations = new Dictionary<AnimationKey, Animation>();

            animation = new Animation(frameCount, spriteWidth, spriteHeight, 0, 0, false);
            animation.FramesPerSecond = 10;

            animations.Add(AnimationKey.Down, animation);

            animation = new Animation(frameCount, spriteWidth, spriteHeight, 0, spriteHeight, false);
            animation.FramesPerSecond = 10;

            animations.Add(AnimationKey.Right, animation);

            animation = new Animation(frameCount, spriteWidth, spriteHeight, 0, spriteHeight * 2, false);
            animation.FramesPerSecond = 10;

            animations.Add(AnimationKey.Left, animation);

            animation = new Animation(frameCount, spriteWidth, spriteHeight, 0, spriteHeight * 3, false);
            animation.FramesPerSecond = 10;

            animations.Add(AnimationKey.Up, animation);

            sprite = new AnimatedSprite(
                attackTexture,
                animations,
                Color.White);

            AnimatedSprites.Add("Attack", sprite);

            _health = new AttributePair(400);
            _shield = new AttributePair(200);

            Rectangle windowBounds = World.Game.Window.ClientBounds;
            _inventory = new InventoryManager(World.Game.Content, new Vector2(10, windowBounds.Height - 70));
            _velocity = new Vector2(3, 3);

            this.XCollisionOffset = 30;
            this.TopCollisionOffset = (int)(CurrentSprite.Height / 2);

            _healthClock = new HealthClock(_health, _shield, new Vector2(10, 10), World.Game.Content);
        }