Exemplo n.º 1
0
        private void _on_Button_button_up()
        {
            characterChoices[playerOneIndex].ConfirmChoice(PlayerChoice.One);
            characterChoices[playerTwoIndex].ConfirmChoice(PlayerChoice.Two);
            playerTwoLock = true;
            playerOneLock = true;

            if (playerOneLock && (playerTwoLock || singlePlayerMode))
            {
                WFS.Global global = (WFS.Global)GetNode("/root/Global");
                global.FirstCharacterSpriteFrameSelection  = characterChoices[playerOneIndex].name;
                global.SecondCharacterSpriteFrameSelection = characterChoices[playerTwoIndex].name;
                global.GotoScene("res://Scenes/Root.tscn");
            }
        }
Exemplo n.º 2
0
        public override void _Process(float delta)
        {
            if (!playerOneLock && playerOneIndex < amount - 1 && (Input.IsActionJustReleased("ui_up_second") || Input.IsActionJustReleased("ui_right_second")))
            {
                characterChoices[playerOneIndex++].Unchosen(PlayerChoice.One);
            }
            else if (!playerOneLock && playerOneIndex > 0 && (Input.IsActionJustReleased("ui_left_second") || Input.IsActionJustReleased("ui_down_second")))
            {
                characterChoices[playerOneIndex--].Unchosen(PlayerChoice.One);
            }
            if (!singlePlayerMode)
            {
                if (!playerTwoLock && playerTwoIndex < amount - 1 && (Input.IsActionJustReleased("ui_up") || Input.IsActionJustReleased("ui_right")))
                {
                    characterChoices[playerTwoIndex++].Unchosen(PlayerChoice.Two);
                }
                else if (!playerTwoLock && playerTwoIndex > 0 && (Input.IsActionJustReleased("ui_left") || Input.IsActionJustReleased("ui_down")))
                {
                    characterChoices[playerTwoIndex--].Unchosen(PlayerChoice.Two);
                }
            }

            characterChoices[playerOneIndex].Chosen(PlayerChoice.One);
            characterChoices[playerTwoIndex].Chosen(PlayerChoice.Two);

            //if (Input.IsActionJustReleased("ui_accept_second"))
            //{
            //    characterChoices[playerOneIndex].ConfirmChoice(PlayerChoice.One);
            //    playerOneLock = true;
            //}
            if (Input.IsActionJustReleased("ui_accept"))
            {
                characterChoices[playerOneIndex].ConfirmChoice(PlayerChoice.One);
                characterChoices[playerTwoIndex].ConfirmChoice(PlayerChoice.Two);
                playerTwoLock = true;
                playerOneLock = true;
            }

            if (playerOneLock && (playerTwoLock || singlePlayerMode))
            {
                WFS.Global global = (WFS.Global)GetNode("/root/Global");
                global.FirstCharacterSpriteFrameSelection  = characterChoices[playerOneIndex].name;
                global.SecondCharacterSpriteFrameSelection = characterChoices[playerTwoIndex].name;

                global.GotoScene("res://Scenes/Root.tscn");
            }
        }
Exemplo n.º 3
0
        public override void _Ready()
        {
            characterChoices = new List <CharacterChoice>();

            WFS.Global global = (WFS.Global)GetNode("/root/Global");
            singlePlayerMode = global.singlePlayer;

//             if (singlePlayerMode)
//             {
//                 playerTwoLock = false;
//                 characterChoices[playerTwoIndex].Unchosen(PlayerChoice.Two);
//             }
            foreach (var node in GetChildren())
            {
                if (node != null && node is CharacterChoice)
                {
                    characterChoices.Add((CharacterChoice)node);
                }
            }
        }
Exemplo n.º 4
0
        public override void _Ready()
        {
            healthMax     = (int)Global.config.GetValue("Config", "InitHealth");
            healthCurrent = healthMax;

            actionToAnimation = new Dictionary <Action, string>();

            actionToAnimation[Action.Death]          = "Death";
            actionToAnimation[Action.NegativeSecond] = "Left";
            actionToAnimation[Action.NegativeFirst]  = "Down";
            actionToAnimation[Action.Timeout]        = "Idle";
            actionToAnimation[Action.PositiveFirst]  = "Up";
            actionToAnimation[Action.PositiveSecond] = "Right";

            movementState  = Action.Timeout;
            animatedSprite = (AnimatedSprite)GetNode("AnimatedSprite");

            WFS.Global global = (WFS.Global)GetNode("/root/Global");

            string path = "res://SpriteFrames/" +
                          (second ? global.FirstCharacterSpriteFrameSelection :
                           global.SecondCharacterSpriteFrameSelection) + ".tres";

            var spriteFrames = (SpriteFrames)GD.Load(path);

            animatedSprite.SetSpriteFrames(spriteFrames);

            animatedSprite.FlipH = second;
            animatedSprite.FlipV = false;
            animatedSprite.Play();

            prompt       = (AnimatedSprite)GetNode("Prompt");
            prompt.FlipH = false;
            prompt.FlipV = false;
            animatedSprite.Play();

            Blood = (Particles2D)GetNode("Blood");

            animationPlayer = (AnimationPlayer)GetNode("animation");
        }