Beispiel #1
0
        internal void AnimationReady(Game game)
        {
            if (_start == false)
            {
                if (game._clock.ElapsedTime.AsSeconds() < 2f)
                {
                    game._fighter1._sprite.Position = new Vector2f(250, game._stage._groundHeight - game._fighter1._sprite.TextureRect.Height * game._fighter1._sprite.Scale.Y);
                    game._fighter2._sprite.Position = new Vector2f(1650, game._stage._groundHeight - game._fighter2._sprite.TextureRect.Height * game._fighter2._sprite.Scale.Y);
                    game._fighter1._canMove         = false;
                    game._fighter1._canJump         = false;
                    game._fighter2._canMove         = false;
                    game._fighter2._canJump         = false;

                    _text.DisplayedString = "Ready";
                    _text.Position        = new Vector2f(960 - (_text.GetGlobalBounds().Width / 2), 540 - (_text.GetGlobalBounds().Height / 2));
                }
                else if (game._clock.ElapsedTime.AsSeconds() < 3f)
                {
                    _text.DisplayedString = "3";
                    _text.CharacterSize   = 450;
                    _text.Position        = new Vector2f(960 - (_text.GetGlobalBounds().Width / 2), 540 - (_text.GetGlobalBounds().Height / 2));
                }
                else if (game._clock.ElapsedTime.AsSeconds() < 4f)
                {
                    _text.DisplayedString = "2";
                    _text.Position        = new Vector2f(960 - (_text.GetGlobalBounds().Width / 2), 540 - (_text.GetGlobalBounds().Height / 2));
                }
                else if (game._clock.ElapsedTime.AsSeconds() < 5f)
                {
                    _text.DisplayedString = "1";
                    _text.Position        = new Vector2f(960 - (_text.GetGlobalBounds().Width / 2), 540 - (_text.GetGlobalBounds().Height / 2));
                }
                else if (game._clock.ElapsedTime.AsSeconds() < 6f)
                {
                    _text.DisplayedString   = "FIGHT !";
                    _text.CharacterSize     = 160;
                    _text.Position          = new Vector2f(960 - (_text.GetGlobalBounds().Width / 2), 540 - (_text.GetGlobalBounds().Height / 2));
                    game._fighter1._canMove = true;
                    game._fighter1._canJump = true;
                    game._fighter2._canMove = true;
                    game._fighter2._canJump = true;
                }
                else
                {
                    _start = true;
                    game._clock.Restart();
                    _text.DisplayedString = string.Empty;
                }
            }
        }
        internal PlayerName(Game game, HealthBar bar)
        {
            _namePlayer1 = new Text
            {
                Font             = new Font("../../../Resources/Fonts/Cocogoose/CocogooseBold.ttf"),
                Position         = new Vector2f(190f, 6f),
                DisplayedString  = game._fighter1.Name,
                CharacterSize    = 35,
                Style            = Text.Styles.Italic,
                OutlineColor     = Color.Black,
                OutlineThickness = 4f,
            };
            _namePlayer1.Position = new Vector2f(bar.Bar[0].Position.X, _namePlayer1.Position.Y);


            _namePlayer2 = new Text(_namePlayer1)
            {
                DisplayedString = game._fighter2.Name,
            };
            _namePlayer2.Position = new Vector2f(bar.Bar[1].Position.X + bar.Bar[1].Size.X - _namePlayer2.GetGlobalBounds().Width, _namePlayer2.Position.Y);
        }
Beispiel #3
0
        public IAppState Update(RenderWindow window)
        {
            _searchText.Position = new Vector2f(_searchBar.GetGlobalBounds().Left + (_searchBar.GetGlobalBounds().Width / 2) - (_searchText.GetGlobalBounds().Width / 2), _searchBar.GetGlobalBounds().Top + (_searchBar.GetGlobalBounds().Height / 2) - (_searchText.GetGlobalBounds().Height / 2));

            MousePosition = new Vector2f(Mouse.GetPosition(window).X, Mouse.GetPosition(window).Y);
            //if ( Mouse.IsButtonPressed(Mouse.Button.Left) ) ClickOnSearchBar(window);
            //window.MouseButtonReleased += (sender, e) => ClickOnSearchBar(e);
            //if ( _inSearchBar == true ) WriteAdressIP(window);
            return(_nextState);
        }