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


C# Controls.moveLeft方法代码示例

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


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

示例2: Update

        public void Update(Controls key)
        {
            if(!dataLoaded)
                LoadFromDevice();

            level0Percent = Convert.ToInt32(loadData.saveLevel0);
            level1Percent = Convert.ToInt32(loadData.saveLevel1);
            level2Percent = Convert.ToInt32(loadData.saveLevel2);
            level3Percent = Convert.ToInt32(loadData.saveLevel3);
            level4Percent = Convert.ToInt32(loadData.saveLevel4);
            level5Percent = Convert.ToInt32(loadData.saveLevel5);
            level6Percent = Convert.ToInt32(loadData.saveLevel6);
            level7Percent = Convert.ToInt32(loadData.saveLevel7);
            playedLevel0 = Convert.ToInt32(loadData.level0Played);
            averageLevel0 = Convert.ToUInt32(loadData.level0Average);
            playedLevel1 = Convert.ToInt32(loadData.level1Played);
            averageLevel1 = Convert.ToUInt32(loadData.level1Average);
            playedLevel2 = Convert.ToInt32(loadData.level2Played);
            averageLevel2 = Convert.ToUInt32(loadData.level2Average);
            playedLevel3 = Convert.ToInt32(loadData.level3Played);
            averageLevel3 = Convert.ToUInt32(loadData.level3Average);
            playedLevel4 = Convert.ToInt32(loadData.level4Played);
            averageLevel4 = Convert.ToUInt32(loadData.level4Average);
            playedLevel5 = Convert.ToInt32(loadData.level5Played);
            averageLevel5 = Convert.ToUInt32(loadData.level5Average);
            playedLevel6 = Convert.ToInt32(loadData.level6Played);
            averageLevel6 = Convert.ToUInt32(loadData.level6Average);
            playedLevel7 = Convert.ToInt32(loadData.level7Played);
            averageLevel7 = Convert.ToUInt32(loadData.level7Average);

            level0Fastest = Convert.ToInt32(loadData.level0Fastest);
            level1Fastest = Convert.ToInt32(loadData.level1Fastest);
            level2Fastest = Convert.ToInt32(loadData.level2Fastest);
            level3Fastest = Convert.ToInt32(loadData.level3Fastest);
            level4Fastest = Convert.ToInt32(loadData.level4Fastest);
            level5Fastest = Convert.ToInt32(loadData.level5Fastest);
            level6Fastest = Convert.ToInt32(loadData.level6Fastest);
            level7Fastest = Convert.ToInt32(loadData.level7Fastest);

            if (key.moveLeft() && timer == 0)
            {
                if (selected > 0)
                    selected--;

                timer = 30;
            }

            if (key.moveRight() && timer == 0)
            {
                if (selected < 7)
                    selected++;

                timer = 30;
            }

            level0Size = minScale;
            level1Size = minScale;
            level2Size = minScale;
            level3Size = minScale;
            level4Size = minScale;
            level5Size = minScale;
            level6Size = minScale;
            level7Size = minScale;

            level0Pos = new Vector2(2000, 0);
            level1Pos = new Vector2(2000, 0);
            level2Pos = new Vector2(2000, 0);
            level3Pos = new Vector2(2000, 0);
            level4Pos = new Vector2(2000, 0);
            level5Pos = new Vector2(2000, 0);
            level6Pos = new Vector2(2000, 0);
            level7Pos = new Vector2(2000, 0);

            switch (selected)
            {
                case 0:
                    {
                        level0Size = maxScale;
                        level0Pos = new Vector2(0, 0);
                        level1Pos = new Vector2(410, 76);
                    }
                    break;
                case 1:
                    {
                        level1Size = maxScale;
                        level0Pos = new Vector2(-210, 76);
                        level1Pos = new Vector2(0, 0);
                        level2Pos = new Vector2(410, 76);
                    }
                    break;
                case 2:
                    {
                        level2Size = maxScale;
                        level1Pos = new Vector2(-210, 76);
                        level2Pos = new Vector2(0, 0);
                        level3Pos = new Vector2(410, 76);
                    }
                    break;
                case 3:
                    {
//.........这里部分代码省略.........
开发者ID:CWentz,项目名称:ParasiteParadiseOriginal,代码行数:101,代码来源:SaveLoadScreen.cs


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