Exemple #1
0
        protected override bool PlayingCard(float delta)
        {
            UpdateCards(delta);

            PositionComponent growPositionComponent = growEntity.GetComponent <PositionComponent>();

            growPositionComponent.Position += (new Vector2(growPositionComponent.Position.X, (window.Height / LD34Game.Scale) / 1.5f + 32f) - growPositionComponent.Position) * 16f * delta;
            PositionComponent playPositionComponent = playEntity.GetComponent <PositionComponent>();

            playPositionComponent.Position += (new Vector2(playPositionComponent.Position.X, (window.Height / LD34Game.Scale) / 1.5f + 32f) - playPositionComponent.Position) * 16f * delta;

            PositionComponent focusPositionComponent = FocusCard.GetComponent <PositionComponent>();
            Vector2           targetPosition         = new Vector2((window.Width / LD34Game.Scale) / 2f - 32f, (window.Height / LD34Game.Scale) / 2f - 48f);

            focusPositionComponent.Position += (targetPosition - focusPositionComponent.Position) * 4f * delta;

            if (Vector2.Distance(targetPosition, focusPositionComponent.Position) <= (window.Height / LD34Game.Scale) / 16f)
            {
                CardComponent focusCardComponent = FocusCard.GetComponent <CardComponent>();
                focusCardComponent.Opacity += (0f - focusCardComponent.Opacity) * 8f * delta;
                if (focusCardComponent.Opacity <= 0.025f)
                {
                    focusCardComponent.Card.Play(EntityWorld, true);
                    return(true);
                }
            }
            return(false);
        }
Exemple #2
0
        protected override void ChoosingCard(float delta)
        {
            UpdateCards(delta);

            if (growEntity == null)
            {
                growEntity = EntityWorld.CreateEntity();
                growEntity.AddComponent(new PositionComponent(new Vector2((window.Width / LD34Game.Scale) / 2f + 48f, (window.Height / LD34Game.Scale) / 1.5f + 256f)));
                growEntity.AddComponent(new SpriteComponent(growIcon, growIcon.Bounds, Color.White, 0f));
            }

            if (playEntity == null)
            {
                playEntity = EntityWorld.CreateEntity();
                playEntity.AddComponent(new PositionComponent(new Vector2((window.Width / LD34Game.Scale) / 2f - 48f - playIcon.Width, (window.Height / LD34Game.Scale) / 1.5f + 256f)));
                playEntity.AddComponent(new SpriteComponent(playIcon, playIcon.Bounds, Color.White, 0f));
            }

            SpriteComponent growSpriteComponent = growEntity.GetComponent <SpriteComponent>();

            growSpriteComponent.Opacity += (1f - growSpriteComponent.Opacity) * 4f * delta;
            SpriteComponent playSpriteComponent = playEntity.GetComponent <SpriteComponent>();

            playSpriteComponent.Opacity += (1f - playSpriteComponent.Opacity) * 4f * delta;

            PositionComponent growPositionComponent = growEntity.GetComponent <PositionComponent>();

            growPositionComponent.Position += (new Vector2(growPositionComponent.Position.X, (window.Height / LD34Game.Scale) / 1.5f + 32f) - growPositionComponent.Position) * 8f * delta;
            PositionComponent playPositionComponent = playEntity.GetComponent <PositionComponent>();

            playPositionComponent.Position += (new Vector2(playPositionComponent.Position.X, (window.Height / LD34Game.Scale) / 1.5f + 32f) - playPositionComponent.Position) * 8f * delta;

            PositionComponent focusPositionComponent = FocusCard.GetComponent <PositionComponent>();
            Vector2           focusTargetPosition    = new Vector2((window.Width / LD34Game.Scale) / 2f - 32f, (window.Height / LD34Game.Scale) / 1.5f);

            focusTargetPosition.Y           -= offsetFocus ? 48f : 0f;
            focusPositionComponent.Position += (focusTargetPosition - focusPositionComponent.Position) * 4f * delta;

            CardComponent focusCardComponent = FocusCard.GetComponent <CardComponent>();

            focusCardComponent.Separation += (1f - focusCardComponent.Separation) * 12f * delta;
        }