title: Cannot Implicitly Convert Type in XNA
body: <p>i have a bouncing ball, and i tried to make so when it bounces once, the speed gets higher.</p>
  
  <p>In my ball class, i have a <code>float speed;</code></p>
  
  <p>and i initialized it:
  <code>public ball(float speed)
  speed = 1f;</code></p>
  
  <p>I have a method for my ball movement, that looks like this:</p>
  
  <pre><code>public void BallMovement()
  {
      if (movingUp) { ballRect.Y -= speed; }//Error
      if (!movingUp) {  ballRect.Y += speed; }//Error
      if (movingLeft) {  ballRect.X -= speed; }//Error
      if (!movingLeft) {  ballRect.X += speed; }//Error
  
      if (ballPosition.Y &lt; 85)
      {
          movingUp = false;
      }
      if (ballPosition.Y &gt;= 480)
      {
          movingUp = true;
      }
  </code></pre>
  
  <p>I then add this in the update method: <code>BallMovement();</code></p>
  
  <p>It worked before i tried to use the speed variable, it won't compile because of this error:</p>
  
  <blockquote>
    <p>Cannot implicitly convert type 'float' to 'int'.An explicit conversion exists(are you missing a cast?)</p>
  </blockquote>