title: Trying to make Animated Sprite Class; Sprite Won't Move
body: <p>So, I was trying to create a class in C++ for an animated sprite that uses spritesheets for input, and when trying to move the sprite, it just sort of bounces back. It won't save to the position. </p>
  
  <p>I tried using <code>.setPostion()</code> but  that still bounces back to where it was. I have no other methods of moving the sprite implemented, nor updating it or anything else. The part in concern in the member function run, which is void is:</p>
  
  <pre><code>//if statement
  if (sf::Keyboard::isKeyPressed(sf::Keyboard::Right))
  {
      curranim[2] = Right;
      playerSprite.setPosition(playerSprite.getPosition().x + walkingSpeed, 0);
  }
  
  window.draw(playerSprite);  
  //spritesheet.cpp ends here
  </code></pre>
  
  <p>Now here is my main function:</p>
  
  <pre><code>int main()
  {
      sf::RenderWindow Window(sf::VideoMode(900, 600), "RPG");
      animsprite sprite("dragon.png", 1, Window);
      sprite.setWalkSpeed(10);
  
      sf::Event Event;
  
      while (Window.isOpen())
      {
          while (Window.pollEvent(Event))
          {
              switch (Event.type) 
              {
                  case sf::Event::Closed:
                      Window.close();
                      break;
              }
          }
  
          Window.clear();
          sprite.run(Window);
          Window.display();
  
      }
  
      return 0;
   }
  </code></pre>
  
  <p>Will I be stuck to repeating my code forever or is there a fix?</p>