コード例 #1
0
        override public void Reset(float x)
        {
            int randomNum = (rand.Next(0, 2));

            if (randomNum == 0)
            {
                // Magma
                trap.Visible(true);
                pit.Visible(false);
                magmaTrap = true;
            }
            else
            {
                // Magma
                trap.Visible(false);
                pit.Visible(true);
                magmaTrap = false;
            }

            springReleased = true;
            missedSpring   = true;
            beingPushed    = false;

            float sizeDifference = (springTopWidth - springWidth) / 2;

            springSprite.Position  = new Vector2(x, springSprite.Position.Y);
            springSprite2.Position = springSprite.Position + new Vector2(58.0f, 48.0f);
            trap.SetXPos(x + 125 + sizeDifference);
            pit.SetXPos(x + 125 + sizeDifference);
            springTopSprite.Position = new Vector2(x + sizeDifference, springTopSprite.Position.Y);
        }
コード例 #2
0
        //Set X position of the seasaw
        public void SetXPos(float x)
        {
            int randomNum = (rand.Next(0, 2));

            if (randomNum == 0)
            {
                // Magma
                _trap.Visible(true);
                _pit.Visible(false);
            }
            else
            {
                // Magma
                _trap.Visible(false);
                _pit.Visible(true);
            }

            _sprite.Position = new Vector2(x + 180, _defaultYPos);
            _trap.SetXPos(x);
            _pit.SetXPos(x);
        }