Gravity Formula

What is the formula for a sprite to jump x blocks high? I need exactly x tiles high.

2 Likes

@richard :eyes:

richard always brings this up on stream! but I can never remember it XD

3 Likes

Yes, I can’t remember it either. I once new it, long ago… when there were dragons and ancient for- okay I’ll stop.

2 Likes

what is the value of x?

Just x. You plug it into the formula.

x is used as a variable. Then they will technically plug some variables into a table
|||||||||||||X|||||f(x)

  • f(1) | 200
  • f(2) | 300
  • f(3) | 400
  • f(4) | 500
    The equation for this problem: explicit formula: f(x)=100x+100
    Recursive Formula: f(n)=f(n-1)+100
    This is just an example.
    X would be equal to how many tiles they jump
    f(x) would be equal to what the velocity would be if they would jump. I guess it wouldn’t make sense if the velocity is 100 and it doesn’t jump a pixel.
    It’s math but I don’t know the velocity either.
    It’s a reason for a variable

Here’s the formula:

JUMP_VELOCITY = - squareRoot(2 * GRAVITY * JUMP_HEIGHT)

In blocks:

7 Likes