コード例 #1
0
        public override void LoadAnimations()
        {
            //15 frame color change normal, 6 frame color change faster
            //2 frame spark change for normal and faster
            //Bomb starts brown, turns red 1 frame after fully stopping, then starts the spark
            //Spark order is red, orange, grey. It cycles back to red after grey
            Texture2D spriteSheet = AssetManager.Instance.LoadRawTexture2D($"{ContentGlobals.SpriteRoot}/Neutral/BobberyBomb.png");

            double bombFrameRate  = (1d / 15d) * 1000d;
            double sparkFrameRate = (1d / 30d) * 1000d;

            AnimManager.AddAnimation(AnimationGlobals.IdleName, new LoopAnimation(spriteSheet, AnimationGlobals.InfiniteLoop,
                                                                                  new Animation.Frame(new Rectangle(62, 1, 65, 68), bombFrameRate),
                                                                                  new Animation.Frame(new Rectangle(62, 72, 65, 68), bombFrameRate)));

            SparkAnimation = new LoopAnimation(spriteSheet, AnimationGlobals.InfiniteLoop,
                                               new Animation.Frame(new Rectangle(0, 0, 32, 24), sparkFrameRate),
                                               new Animation.Frame(new Rectangle(0, 24, 32, 24), sparkFrameRate),
                                               new Animation.Frame(new Rectangle(0, 48, 32, 24), sparkFrameRate));

            //Pause the spark animation until we're ready to play it
            SparkAnimation.Pause();
        }
コード例 #2
0
        public BobberyBomb(int damage) : base(new Stats(0, 1, 0, damage, 0))
        {
            Name = "Bobbery Bomb";

            EntityType = EntityTypes.Neutral;

            //Explosions cause the bombs to detonate (only possible from other Bobbery Bombs in the actual games)
            EntityProperties.AddWeakness(Elements.Explosion, new WeaknessHolder(WeaknessTypes.KO, 0));

            //Add the Untargetable property so the bombs cannot be targeted
            this.AddIntAdditionalProperty(AdditionalProperty.Untargetable, 1);

            //15 frame color change normal, 6 frame color change faster
            //2 frame spark change for normal and faster
            //Bomb starts brown, turns red 1 frame after fully stopping, then starts the spark
            //Spark order is red, orange, grey. It cycles back to red after grey
            Texture2D spriteSheet = AssetManager.Instance.LoadRawTexture2D($"{ContentGlobals.SpriteRoot}/Neutral/BobberyBomb.png");

            double bombFrameRate  = (1d / 15d) * 1000d;
            double sparkFrameRate = (1d / 30d) * 1000d;

            AnimManager.AddAnimation(AnimationGlobals.IdleName, new LoopAnimation(spriteSheet, AnimationGlobals.InfiniteLoop,
                                                                                  new Animation.Frame(new Rectangle(62, 1, 65, 68), bombFrameRate),
                                                                                  new Animation.Frame(new Rectangle(62, 72, 65, 68), bombFrameRate)));

            //Offset the spark animation so we can play it in the same position as the bombs
            Vector2 sparkOffset = new Vector2(16, -68 / 4);

            SparkAnimation = new LoopAnimation(spriteSheet, AnimationGlobals.InfiniteLoop,
                                               new Animation.Frame(new Rectangle(0, 0, 32, 24), sparkFrameRate, sparkOffset),
                                               new Animation.Frame(new Rectangle(0, 24, 32, 24), sparkFrameRate, sparkOffset),
                                               new Animation.Frame(new Rectangle(0, 48, 32, 24), sparkFrameRate, sparkOffset));

            //Pause the spark animation until we're ready to play it
            SparkAnimation.Pause();
        }