Esempio n. 1
0
        public Bubbler(EntityData data, Vector2 offset) : base(data.Position + offset)
        {
            visible  = data.Bool("visible", false);
            Collider = new Hitbox(14f, 14f, 0f, 0f);
            Collider.CenterOrigin();
            Add(new PlayerCollider(new Action <Player>(OnPlayer), null, null));
            color = ColorHelper.GetColor(data.Attr("color", "White"));

            nodes = data.NodesOffset(offset);

            if (visible)
            {
                Add(sprite = new Sprite(GFX.Game, "objects/FrostHelper/bubble"));
                sprite.AddLoop("idle", "", 0.1f);
                sprite.CenterOrigin();
                sprite.Play("idle", false, false);
                sprite.SetColor(color);
                Add(previewSprite = new Sprite(GFX.Game, "objects/FrostHelper/bubble"));
                previewSprite.AddLoop("idle", "", 0.1f);
                previewSprite.CenterOrigin();
                previewSprite.Play("idle", false, false);
                previewSprite.Position = nodes.Last() - Position;
                previewSprite.SetColor(new Color(color.R, color.G, color.B, 128f) * 0.3f);
            }
        }
 public CustomDreamBlock(EntityData data, Vector2 offset) : base(data.Position + offset, data.Width, data.Height, true)
 {
     whiteFill   = 0f;
     whiteHeight = 1f;
     wobbleFrom  = Calc.Random.NextFloat(6.28318548f);
     wobbleTo    = Calc.Random.NextFloat(6.28318548f);
     wobbleEase  = 0f;
     Depth       = -11000;
     node        = data.FirstNodeNullable(new Vector2?(offset));
     fastMoving  = data.Bool("fastMoving", false);
     oneUse      = data.Bool("oneUse", false);
     if (data.Bool("below", false))
     {
         Depth = 5000;
     }
     SurfaceSoundIndex = 11;
     particleTextures  = new MTexture[]
     {
         GFX.Game["objects/dreamblock/particles"].GetSubtexture(14, 0, 7, 7, null),
         GFX.Game["objects/dreamblock/particles"].GetSubtexture(7, 0, 7, 7, null),
         GFX.Game["objects/dreamblock/particles"].GetSubtexture(0, 0, 7, 7, null),
         GFX.Game["objects/dreamblock/particles"].GetSubtexture(7, 0, 7, 7, null)
     };
     activeBackColor              = ColorHelper.GetColor(data.Attr("activeBackColor", "Black"));
     disabledBackColor            = ColorHelper.GetColor(data.Attr("disabledBackColor", "1f2e2d"));
     activeLineColor              = ColorHelper.GetColor(data.Attr("activeLineColor", "White"));
     disabledLineColor            = ColorHelper.GetColor(data.Attr("disabledLineColor", "6a8480"));
     DashSpeed                    = data.Float("speed", 240f);
     AllowRedirects               = data.Bool("allowRedirects");
     AllowRedirectsInSameDir      = data.Bool("allowSameDirectionDash");
     SameDirectionSpeedMultiplier = data.Float("sameDirectionSpeedMultiplier", 1f);
 }
Esempio n. 3
0
 public CustomDreamBlockV2(EntityData data, Vector2 offset) : base(data, offset)
 {
     ActiveBackColor              = ColorHelper.GetColor(data.Attr("activeBackColor", "Black"));
     DisabledBackColor            = ColorHelper.GetColor(data.Attr("disabledBackColor", "1f2e2d"));
     ActiveLineColor              = ColorHelper.GetColor(data.Attr("activeLineColor", "White"));
     DisabledLineColor            = ColorHelper.GetColor(data.Attr("disabledLineColor", "6a8480"));
     DashSpeed                    = data.Float("speed", 240f);
     AllowRedirects               = data.Bool("allowRedirects");
     AllowRedirectsInSameDir      = data.Bool("allowSameDirectionDash");
     SameDirectionSpeedMultiplier = data.Float("sameDirectionSpeedMultiplier", 1f);
     node          = data.FirstNodeNullable(new Vector2?(offset));
     moveSpeedMult = data.Float("moveSpeedMult", 1f);
     easer         = EaseHelper.GetEase(data.Attr("moveEase", "SineInOut"));
     ConserveSpeed = data.Bool("conserveSpeed", false);
     // legacy
     fastMoving = data.Bool("fastMoving", false);
 }
Esempio n. 4
0
        public YellowBooster(EntityData data, Vector2 offset) : base(data.Position + offset)
        {
            Depth          = -8500;
            Collider       = new Circle(10f, 0f, 2f);
            sprite         = new Sprite(GFX.Game, data.Attr("directory", "objects/FrostHelper/yellowBooster/"));
            sprite.Visible = true;
            sprite.CenterOrigin();
            sprite.Justify = new Vector2(0.5f, 0.5f);
            sprite.AddLoop("loop", "booster", 0.1f, 0, 1, 2, 3, 4);
            sprite.AddLoop("inside", "booster", 0.1f, 5, 6, 7, 8);
            sprite.AddLoop("spin", "booster", 0.06f, 18, 19, 20, 21, 22, 23, 24, 25);
            sprite.Add("pop", "booster", 0.08f, 9, 10, 11, 12, 13, 14, 15, 16, 17);
            sprite.Play("loop", false);
            Add(sprite);

            Add(new PlayerCollider(new Action <Player>(OnPlayer), null, null));
            Add(light   = new VertexLight(Color.White, 1f, 16, 32));
            Add(bloom   = new BloomPoint(0.1f, 16f));
            Add(wiggler = Wiggler.Create(0.5f, 4f, delegate(float f)
            {
                sprite.Scale = Vector2.One * (1f + f * 0.25f);
            }, false, false));
            Add(dashRoutine  = new Coroutine(false));
            Add(dashListener = new DashListener());
            Add(new MirrorReflection());
            Add(loopingSfx      = new SoundSource());
            dashListener.OnDash = new Action <Vector2>(OnPlayerDashed);
            particleType        = Booster.P_Burst;

            RespawnTime   = data.Float("respawnTime", 1f);
            BoostTime     = data.Float("boostTime", 0.3f);
            ParticleColor = ColorHelper.GetColor(data.Attr("particleColor", "Yellow"));
            FlashTint     = ColorHelper.GetColor(data.Attr("flashTint", "Red"));
            reappearSfx   = data.Attr("reappearSfx", "event:/game/04_cliffside/greenbooster_reappear");
            enterSfx      = data.Attr("enterSfx", "event:/game/04_cliffside/greenbooster_enter");
            boostSfx      = data.Attr("boostSfx", "event:/game/04_cliffside/greenbooster_dash");
            endSfx        = data.Attr("releaseSfx", "event:/game/04_cliffside/greenbooster_end");
        }
Esempio n. 5
0
        public CustomFeather(EntityData data, Vector2 offset) : base(data.Position + offset)
        {
            shielded     = data.Bool("shielded", false);
            singleUse    = data.Bool("singleUse", false);
            RespawnTime  = data.Float("respawnTime", 3f);
            FlyColor     = ColorHelper.GetColor(data.Attr("flyColor", "ffd65c"));
            FlyTime      = data.Float("flyTime", 2f);
            MaxSpeed     = data.Float("maxSpeed", 190f);
            LowSpeed     = data.Float("lowSpeed", 140f);
            NeutralSpeed = data.Float("neutralSpeed", 91f);
            Collider     = new Hitbox(20f, 20f, -10f, -10f);
            Add(new PlayerCollider(new Action <Player>(OnPlayer), null, null));
            string path = data.Attr("spritePath", "objects/flyFeather/").Replace('\\', '/');

            if (path[path.Length - 1] != '/')
            {
                path += '/';
            }
            sprite = new Sprite(GFX.Game, path)
            {
                Visible = true
            };
            sprite.CenterOrigin();
            sprite.Color   = ColorHelper.GetColor(data.Attr("spriteColor", "White"));
            sprite.Justify = new Vector2(0.5f, 0.5f);
            sprite.Add("loop", "idle", 0.06f, "flash");
            sprite.Add("flash", "flash", 0.06f, "loop");
            sprite.Play("loop");
            Add(sprite);

            Add(wiggler = Wiggler.Create(1f, 4f, delegate(float v)
            {
                sprite.Scale = Vector2.One * (1f + v * 0.2f);
            }, false, false));
            Add(bloom   = new BloomPoint(0.5f, 20f));
            Add(light   = new VertexLight(Color.White, 1f, 16, 48));
            Add(sine    = new SineWave(0.6f, 0f).Randomize());
            Add(outline = new Image(GFX.Game[data.Attr("outlinePath", "objects/flyFeather/outline")]));
            outline.CenterOrigin();
            outline.Visible    = false;
            shieldRadiusWiggle = Wiggler.Create(0.5f, 4f, null, false, false);
            Add(shieldRadiusWiggle);
            moveWiggle           = Wiggler.Create(0.8f, 2f, null, false, false);
            moveWiggle.StartZero = true;
            Add(moveWiggle);
            UpdateY();

            P_Collect = new ParticleType(FlyFeather.P_Collect)
            {
                ColorMode = ParticleType.ColorModes.Static,
                Color     = FlyColor
            };
            P_Flying = new ParticleType(FlyFeather.P_Flying)
            {
                ColorMode = ParticleType.ColorModes.Static,
                Color     = FlyColor
            };
            P_Boost = new ParticleType(FlyFeather.P_Boost)
            {
                ColorMode = ParticleType.ColorModes.Static,
                Color     = FlyColor
            };
        }
 public ColoredLightbeam(EntityData data, Vector2 offset) : base(data, offset)
 {
     LightBeam_color.SetValue(this, ColorHelper.GetColor(data.Attr("color", "ccffff")));
 }
        public CustomSpinner(EntityData data, Vector2 position, bool attachToSolid, string directory, string destroyColor, bool isCore, string tint) : base(data.Position + position)
        {
            ID             = data.ID;
            DashThrough    = data.Bool("dashThrough", false);
            this.tint      = tint;
            Tint           = ColorHelper.GetColor(tint);
            this.directory = directory;

            // for VivHelper compatibility
            SpritePathSuffix = data.Attr("spritePathSuffix", "");

            UpdateDirectoryFields(false);
            moveWithWind = data.Bool("moveWithWind", false);

            // funny story time: this used to exist in older versions of Frost Helper as a leftover.
            // I tried removing it in 1.20.3, but this broke some TASes due to spinner cycles.
            // So now this needs to stay here forever D:
            // List<MTexture> atlasSubtextures = GFX.Game.GetAtlasSubtextures(this.bgDirectory);
            // MTexture mtexture = Calc.Random.Choose(atlasSubtextures);
            // Actually, just calling Random.Next() is enough, so that's nice
            Calc.Random.Next();

            coldDirectory     = directory;
            this.destroyColor = destroyColor;
            this.isCore       = isCore;
            offset            = Calc.Random.NextFloat();
            Tag      = Tags.TransitionUpdate;
            Collider = new ColliderList(new Collider[]
            {
                new Circle(6f, 0f, 0f),
                new Hitbox(16f, 4f, -8f, -3f)
            });
            Visible = false;
            Add(new PlayerCollider(new Action <Player>(OnPlayer), null, null));
            Add(new HoldableCollider(new Action <Holdable>(OnHoldable), null));
            Add(new LedgeBlocker(null));
            Depth = -8500;

            AttachToSolid = attachToSolid;
            if (AttachToSolid)
            {
                Add(new StaticMover
                {
                    OnShake      = new Action <Vector2>(OnShake),
                    SolidChecker = new Func <Solid, bool>(IsRiding),
                    OnDestroy    = new Action(RemoveSelf)
                });
            }

            randomSeed = Calc.Random.Next();
            if (isCore)
            {
                Add(new CoreModeListener(new Action <Session.CoreModes>(OnChangeMode)));
            }
            float bloomAlpha = data.Float("bloomAlpha", 0.0f);

            if (bloomAlpha != 0.0f)
            {
                Add(new BloomPoint(Collider.Center, bloomAlpha, data.Float("bloomRadius", 0f)));
            }
        }
Esempio n. 8
0
 public PlusOneRefill(EntityData data, Vector2 offset) : this(data.Position + offset, data.Bool("oneUse", false), data.Attr("directory", "objects/FrostHelper/plusOneRefill"), data.Int("dashCount", 1), data.Float("respawnTime", 2.5f), ColorHelper.GetColor(data.Attr("particleColor", "ffffff")), data.Bool("recoverStamina", false))
 {
 }