# SFML – My jump never stops

Im making a short jump test in sfml. However I have a problem, whenever the jump button is pressed the character will jump but will not fall down, he will keep going higher. However, in the beginning of the test, I made the sprite above the ground to see if the gravity function worked, but this still happens. Here is a video

Here is my code:

``#include <SFML/Graphics.hpp> using namespace sf;  float VelocityX = 0, VelocityY = 0; float x = 0, y = 0; int gravity = 2; float dt;  void movement() {     if (y < 444) {         VelocityY += gravity * dt;     }     else if (y > 444) {         y = 444;     }     x += VelocityX;     y += VelocityY; }  int main() {     RenderWindow window(VideoMode(800, 600), "jump test");     RectangleShape rect(Vector2f(20, 20));     const int moveSpeed = 500, jumpForce = 10;          Clock deltaTime;     while (window.isOpen())     {         dt = deltaTime.restart().asSeconds();         Event event;          while (window.pollEvent(event)) {             if (event.type == Event::Closed) {                 window.close();             }         }          if (Keyboard::isKeyPressed(Keyboard::Right)) {             VelocityX = moveSpeed * dt;         }         else if (Keyboard::isKeyPressed(Keyboard::Left)) {             VelocityX = -moveSpeed * dt;         }         else {             VelocityX = 0;         }          if (Keyboard::isKeyPressed(Keyboard::Space)) {             VelocityY -= jumpForce;         }                   movement();         rect.setPosition(x, y);           window.clear();         window.draw(rect);         window.display();     }      return 0; } $$```$$ ``