本文整理汇总了C#中Controls.moveUp方法的典型用法代码示例。如果您正苦于以下问题:C# Controls.moveUp方法的具体用法?C# Controls.moveUp怎么用?C# Controls.moveUp使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Controls
的用法示例。
在下文中一共展示了Controls.moveUp方法的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))
//{
//.........这里部分代码省略.........