Exemplo n.º 1
0
        public Item(ItemData data)
        {
            this._name = data.Name;
            this._icon = data.Icon;

            if (data.Sprite != null)
                this._sprite = data.Sprite.Clone();
        }
Exemplo n.º 2
0
        public EBall(Texture2D icon, String name, AnimatedSprite sprite, int wait, AnimatedSprite secondaryProjectileSprite, float throwDistance, float projectileDistance, int spreadAngle, float revolutions, float projectilesPerIteration, String eventType, float destinationX, float destinationY, int aoeLife)
            : base(icon, name, sprite, wait)
        {
            _secondaryProjectileSprite = secondaryProjectileSprite;

            this._allowMulti = false;
            this._hasProjectile = false;

            _throwDistance = throwDistance;
            _projectileDistance = projectileDistance;
            _spreadAngle = MathHelper.ToRadians(spreadAngle);
            _revolutions = revolutions;
            _projectilesPerIteration = projectilesPerIteration;
            _eventType = (EventType)Enum.Parse(typeof(EventType), eventType);

            _aoeDestination = new Vector2(destinationX, destinationY);
            _aoeLife = aoeLife;
        }
Exemplo n.º 3
0
 public Item(Texture2D icon, String name, AnimatedSprite sprite)
     : this(icon, name)
 {
     _sprite = sprite;
 }
Exemplo n.º 4
0
 public SomeConeWeapon(Texture2D icon, String name, AnimatedSprite sprite)
     : base(icon, name, sprite, 20)
 {
     this._allowMulti = false;
     this._hasProjectile = false;
 }
Exemplo n.º 5
0
 public Gun(Texture2D icon, String name, AnimatedSprite sprite)
     : base(icon, name, sprite, 400)
 {
     this._allowMulti = true;
     this._hasProjectile = false;
 }
Exemplo n.º 6
0
        public AnimatedSprite Clone()
        {
            Dictionary<AnimationKey, Animation> animations = new Dictionary<AnimationKey, Animation>();

            foreach (KeyValuePair<AnimationKey, Animation> animation in _animations)
            {
                animations.Add(animation.Key, (Animation)animation.Value.Clone());
            }

            AnimatedSprite sprite = new AnimatedSprite(_texture, animations);
            sprite.Velocity = _velocity;
            sprite.TintColor = _tintColor;
            sprite.IsAnimating = _isAnimating;

            return sprite;
        }
Exemplo n.º 7
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"));
        }
Exemplo n.º 8
0
 public TempaQuip(Texture2D icon, String name, AnimatedSprite sprite, int maxWait)
     : base(icon, name, sprite)
 {
     _maxWaitTime = maxWait;
     _currentWaitTime = maxWait;
 }
Exemplo n.º 9
0
 public TempaQuip(Texture2D icon, String name, AnimatedSprite sprite)
     : base(icon, name, sprite)
 {
 }
Exemplo n.º 10
0
 public Zapper(Texture2D icon, String name, AnimatedSprite sprite)
     : base(icon, name, sprite)
 {
     this._allowMulti = false;
     this._hasProjectile = false;
 }
Exemplo n.º 11
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);
        }