Ejemplo n.º 1
0
 public void SpawnToPlayer(Burst_Plant parent, float vel, Player p)
 {
     Position = parent.Position + Vector2.One * 5;
     parabola = new Parabola_Thing(this, GlobalState.RNG.Next(24, 34), 1.5f);
     MoveTowards(p.Center, vel * 2.5f);
     _state.ChangeState("Move");
 }
Ejemplo n.º 2
0
 public void Spawn()
 {
     Position = parent.Center;
     parabola = new(this, GlobalState.RNG.Next(16, 24), 1f + (float)GlobalState.RNG.NextDouble() / 2);
     Play("move");
     velocity = new(GlobalState.RNG.Next(-30, 30), 30);
 }
Ejemplo n.º 3
0
        public ArthurDanger(EntityPreset preset, Player p)
            : base(preset.Position, "arthur", 16, 16, Drawing.DrawOrder.ENTITIES)
        {
            _preset = preset;

            AddAnimation("walk_d", CreateAnimFrameArray(0, 1), 8);
            AddAnimation("walk_l", CreateAnimFrameArray(4, 5), 8);
            AddAnimation("walk_u", CreateAnimFrameArray(2, 3), 8);
            AddAnimation("walk_r", CreateAnimFrameArray(4, 5), 8);
            AddAnimation("roll", CreateAnimFrameArray(6), 6); // For flying through the air
            AddAnimation("stunned", CreateAnimFrameArray(8, 9), 6);
            AddAnimation("wobble", CreateAnimFrameArray(16, 17), 8);
            AddAnimation("fall_1", CreateAnimFrameArray(10), 8);
            AddAnimation("fall", CreateAnimFrameArray(10, 11, 12, 13, 14, 15, 6), 2, false); // Should end on an empty frame

            _parabola = new Parabola_Thing(this, 32, 1);

            shadow = new Shadow(this, new Vector2(0, -2), ShadowType.Normal);
            Play("wobble");

            Position.Y -= 32;
            offset.Y    = 5 * 16;

            _initPos = Position;

            _dustPillow = new Dust(MapUtilities.GetRoomUpperLeftPos(GlobalState.CurrentMapGrid) + new Vector2(46, 16), p);

            _stateLogic = StateLogic();
        }
Ejemplo n.º 4
0
 public void Spawn(Burst_Plant parent, float max_vel, int sign)
 {
     Position   = parent.Position + Vector2.One * 5;
     parabola   = new Parabola_Thing(this, GlobalState.RNG.Next(24, 34), 0.7f + (float)GlobalState.RNG.NextDouble());
     velocity.X = -max_vel + 2 * max_vel * (float)GlobalState.RNG.NextDouble();
     velocity.Y = sign * MathF.Sqrt(max_vel * max_vel - velocity.X * velocity.X);
     _state.ChangeState("Move");
 }
Ejemplo n.º 5
0
 public SplashBullet(Vector2 startPos) : base(startPos, "red_boss_bullet", 8, 8, Drawing.DrawOrder.FG_SPRITES)
 {
     shadow = new Shadow(this, Vector2.Zero);
     AddAnimation("move", CreateAnimFrameArray(0, 1), 12);
     AddAnimation("explode", CreateAnimFrameArray(2, 3, 4), 14, false);
     this.startPos = startPos;
     parabola      = new(this, 48, 1.2f + (float)GlobalState.RNG.NextDouble());
 }
Ejemplo n.º 6
0
            public BurstBullet(int speed_multiplier) : base(Vector2.Zero, "frog_bullet", 8, 8, Drawing.DrawOrder.FG_SPRITES)
            {
                _multiplier = speed_multiplier + 1;

                parabola = new(this, 16, (float)(0.8 + GlobalState.RNG.NextDouble()));

                shadow = new Shadow(this, new Vector2(3, 2), ShadowType.Normal);

                AddAnimation("move", CreateAnimFrameArray(0, 1), 12);
                AddAnimation("explode", CreateAnimFrameArray(2, 3, 3), 10, false);

                _state = new StateMachineBuilder()
                         .State("Move")
                         .Enter((state) =>
                {
                    Play("move");
                    shadow.exists = true;
                    opacity       = 1.0f;
                })
                         .Update((state, time) =>
                {
                    if (parabola.Tick())
                    {
                        _state.ChangeState("Splash");
                    }
                })
                         .End()
                         .State("Splash")
                         .Enter((state) =>
                {
                    shadow.exists = false;
                    Play("explode");
                    velocity = Vector2.Zero;
                })
                         .Condition(() => _curAnim.Finished, (state) =>
                {
                    exists = false;
                    SoundManager.PlaySoundEffect("bubble_1", "bubble_1", "bubble_2", "bubble_3");
                })
                         .End()
                         .Build();
            }
Ejemplo n.º 7
0
        public Lion(EntityPreset preset, Player player)
            : base(preset.Position, "lion", 32, 32, DrawOrder.ENTITIES)
        {
            _player = player;

            fireballs = new EntityPool <Fireball>(10, () => new Fireball());
            _parabola = new Parabola_Thing(this, 12, 1);

            _shadowV = new Shadow(this, new Vector2(8, -6), ShadowType.BigVertical);
            _shadowH = new Shadow(this, new Vector2(8, -6), ShadowType.Big);

            AddAnimation("walk_l", CreateAnimFrameArray(0, 1), 5);
            AddAnimation("walk_r", CreateAnimFrameArray(0, 1), 5);
            AddAnimation("walk_d", CreateAnimFrameArray(10, 11), 5);
            AddAnimation("walk_u", CreateAnimFrameArray(5, 6), 5);

            AddAnimation("warn_l", CreateAnimFrameArray(3), 5, true);
            AddAnimation("warn_r", CreateAnimFrameArray(3), 5, true);

            AddAnimation("shoot_l", CreateAnimFrameArray(2), 15, true);
            AddAnimation("shoot_r", CreateAnimFrameArray(2), 15, true);
            AddAnimation("shoot_d", CreateAnimFrameArray(12), 15, true);
            AddAnimation("shoot_u", CreateAnimFrameArray(7), 15, true);

            AddAnimation("pounce_r", CreateAnimFrameArray(4));
            AddAnimation("pounce_l", CreateAnimFrameArray(4));
            AddAnimation("pounce_u", CreateAnimFrameArray(9));
            AddAnimation("pounce_d", CreateAnimFrameArray(14));

            Play("walk_r");

            _state = new StateMachineBuilder()
                     .State <PaceState>("Pace")
                     .Event("PaceTimer", (state) =>
            {
                double r = GlobalState.RNG.NextDouble();

                if (r < 0.25)
                {
                    _state.ChangeState("ShootWarning");
                }
                else if (r < 0.55)
                {
                    _state.ChangeState("ChargeWalk");
                }
                else
                {
                    double paceR = GlobalState.RNG.Next(0, 6);

                    if (paceR < 4)
                    {
                        facing = paceR switch
                        {
                            0 => Facing.RIGHT,
                            1 => Facing.DOWN,
                            2 => Facing.LEFT,
                            _ => Facing.UP,
                        };

                        PlayFacing("walk");

                        velocity = FacingDirection(facing) * 43;
                    }