Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Mesiow

Pages: [1]
1
General / Help with Auto Jumping
« on: January 28, 2018, 04:25:51 am »
This is my first sfml project and I am attempting to make a doodle jump clone but I can't figure out how to make the sprite automatically jump. It just stops in the air after one jump. Any help would be appreciated


This is what my jumping function looks like



void Doodle::Jump(sf::RenderWindow &window)
{
     if(getSpritePos().y > window.getPosition().y)
      {
        mSprite.move(mVelocity);
      }

     if(getSprite().getGlobalBounds().intersects(mBottom.getGlobalBounds()))
      {
          mVelocity.y-=mGravity.y*acceleration.y;
          mSprite.move(mVelocity);

      }

      if(mVelocity.y<=0)
      {
          mVelocity.y=-5.0f;
      }

}


 

Pages: [1]
anything