title: Gravity with air-time, acceleration and speed gaining
body: <p><br><br></p>
  
  <p>I am trying to accomplish a gravity, where airtime is included, and also acceleration.<br>I have tried using usual gravity, which looks something like this:<br><br></p>
  
  <pre><code>velocity += gravity * dt;
  position += velocity * dt;
  </code></pre>
  
  <p><br>This would probably work good enough for a normal platformer game, but I am trying to make a game inspired by "The helicopter game", where you have to navigate through a tunnel, without touching the walls.<br><br>what I want to do different, is that I want to be able to save up speed on the way down, which will be used on the way up again, so I will have some acceleration at the beginning.<br>I also want some kind of airtime, so when you hit the top it would not force you down as fast as It would, if I had used the gravity from the code sample.<br><br>This image illustrates the curve I would like to have:<br><img src="https://i.imgur.com/xBuyI.png" alt="Link to curve"><br><br>Please note that the whole controlling is done by one key, so for example you would fly up if you held down space, and dive if you released it.<br>The character also never moves left or right, since it will have a static X position on the screen, so vectors can't be used.<br><br>I have spent hours trying to make it work, but with no success. I have also tried searching on the internet, but without any luck.<br><br>The game "Whale Trails" got the gravity I kind of want.<br>Here is a link for a video of the game: <a href="http://www.youtube.com/watch?v=5OQ0OWcuDJs" rel="nofollow noreferrer">http://www.youtube.com/watch?v=5OQ0OWcuDJs</a><br><br>I'm not that big of a physics guy, so it would be cool if you could give an example of the actual code<br> I hope anyone can help me figure this out.</p>