Exemplo n.º 1
0
        public override void Update(float delta)
        {
            base.Update(delta);

            var sixtyDelta = delta * 60;

            //Area.AngleOffset += MathHelper.Pi / 160;

            if (!OnFloor)
            {
                Velocity.Y += Gravity;
            }
            if (Input.ActionPressed("move_left"))
            {
                Velocity.X  -= Speed;
                Sprite.FlipX = true;
            }
            else if (Input.ActionPressed("move_right"))
            {
                Velocity.X  += Speed;
                Sprite.FlipX = false;
            }
            else
            {
                Velocity.X -= Decel * Math.Sign(Velocity.X);

                if (Math.Abs(Velocity.X) <= Decel)
                {
                    Velocity.X = 0;
                }
            }

            if (Input.ActionJustPressed("fire"))
            {
                Velocity.Y = -JumpHeight;
            }
            else if (Input.ActionJustReleased("fire") && Velocity.Y < 0)
            {
                Velocity.Y *= 0.5f;
            }
        }