Exemplo n.º 1
0
 private void RectangleMovement(RectangleObject rs, Keyboard.Key up, Keyboard.Key down, double elapsedTime)
 {
     if (Keyboard.IsKeyPressed(up))
     {
         rs.RectangleMovementUp(elapsedTime);
     }
     else if (Keyboard.IsKeyPressed(down))
     {
         rs.RectangleMovementDown(elapsedTime, _windowSize.Y);
     }
 }
Exemplo n.º 2
0
        public void GoToNextPosition(double elapsedTime)
        {
            _buffer = (float)elapsedTime;

            if (_rectangleObject.Position.Y < _nextPosition - _buffer)
            {
                _rectangleObject.RectangleMovementDown(elapsedTime, _windowSize.Y);
            }
            else if (_rectangleObject.Position.Y > _nextPosition + _buffer)
            {
                _rectangleObject.RectangleMovementUp(elapsedTime);
            }
        }