当前位置: 首页>>代码示例>>C#>>正文


C# Controls.moveDown方法代码示例

本文整理汇总了C#中Controls.moveDown方法的典型用法代码示例。如果您正苦于以下问题:C# Controls.moveDown方法的具体用法?C# Controls.moveDown怎么用?C# Controls.moveDown使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Controls的用法示例。


在下文中一共展示了Controls.moveDown方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Update

        //public BackgroundSprite(Texture2D _texture, Vector2 _position, float _speed, float _speedConstant, float _screenWidth, float _screenHeight, Vector2 _direction)
        //{
        //    speed = _speed;
        //    speedConstant = _speedConstant;
        //    texture = _texture;
        //    position = _position;
        //    screenHeight = _screenHeight;
        //    screenWidth = _screenWidth;
        //    positionImage5 = position;
        //}
        /// <summary>
        /// Moves the bg in a positive horizontal position(left).
        /// </summary>
        /// <param name="_timeDelta">gameTime total elapsed seconds.</param>
        public void Update(GameTime gameTime, Controls cont, Vector2 _centerPosition)
        {
            float timeDelta = (float)gameTime.ElapsedGameTime.TotalSeconds;

            if (cont.moveRight())
            {
                movingLeft = false;
                movingRight = true;
                venesPosition -= new Vector2(0.5f, 0);
            }
            else if (cont.moveLeft())
            {
                movingLeft = true;
                movingRight = false;
                venesPosition += new Vector2(0.5f, 0);
            }
            else if (cont.moveUp())
            {
                movingUp = true;
                movingDown = false;
                venesPosition += new Vector2(0, 0.5f);
            }
            else if (cont.moveDown())
            {
                movingUp = false;
                movingDown = true;
                venesPosition -= new Vector2(0, 0.5f);
            }

            //else
            //{
            //    movingUp = false;
            //    movingDown = false;
            //}

            /*
            if (movingUp)
                moveUp(timeDelta);
            if (movingDown)
                moveDown(timeDelta);
            if (movingLeft)
                moveLeft(timeDelta);
            if (movingRight)
                moveRight(timeDelta);

             */

            #region BG Repeater Right Movement

            if (positionImage1.X < (-texture.Width / 2) + _centerPosition.X - (texture.Width))
            {
                positionImage1.X = positionImage1.X + (texture.Width * 2);
                positionImage4.X = positionImage4.X + (texture.Width * 2);
                positionImage7.X = positionImage7.X + (texture.Width * 2);
            }

            if (positionImage2.X < (-texture.Width / 2) + _centerPosition.X - (texture.Width))
            {
                positionImage2.X = positionImage2.X + (texture.Width * 2);
                positionImage5.X = positionImage5.X + (texture.Width * 2);
                positionImage8.X = positionImage8.X + (texture.Width * 2);
            }

            if (positionImage3.X < (-texture.Width / 2) + _centerPosition.X - (texture.Width))
            {
                positionImage3.X = positionImage3.X - (texture.Width * 2);
                positionImage6.X = positionImage6.X - (texture.Width * 2);
                positionImage9.X = positionImage9.X - (texture.Width * 2);
            }

            #region w/o camera old code
            /////////////////////////////////////////////////////////
            //////////////////////  second row  //////////////////////
            /////////////////////////////////////////////////////////

            //if (positionImage4.X < -1 * (texture.Width))
            //{
            //    positionImage4.X = positionImage4.X + (texture.Width * 2);
            //}

            //if (positionImage5.X < -1 * (texture.Width))
            //{
            //    positionImage5.X = positionImage5.X + (texture.Width * 2);
            //}
            //if (positionImage6.X < -1 * (texture.Width))
            //{
//.........这里部分代码省略.........
开发者ID:CWentz,项目名称:ParasiteParadiseOriginal,代码行数:101,代码来源:BackgroundSpriteOld.cs


注:本文中的Controls.moveDown方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。