# Gravity Formula

**URL:** <https://forum.makecode.com/t/gravity-formula/3821>\
**Category:** Help\
**Created:** [October 9, 2020, 1:09am UTC](https://forum.makecode.com/t/gravity-formula/3821 "2020-10-09T01:09:12Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![GameGod](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/gamegod/32/2756_2.png) [@GameGod](https://forum.makecode.com/u/GameGod)\
**Post date:** [October 9, 2020, 1:09am UTC](https://forum.makecode.com/t/gravity-formula/3821/1 "2020-10-09T01:09:12Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![livcheerful](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/livcheerful/32/3509_2.png) [@livcheerful](https://forum.makecode.com/u/livcheerful)\
**Post date:** [October 9, 2020, 1:20am UTC](https://forum.makecode.com/t/gravity-formula/3821/2 "2020-10-09T01:20:49Z")

</div>

@richard 👀

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

---

<div class="post-metadata">

**Author:** ![GameGod](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/gamegod/32/2756_2.png) [@GameGod](https://forum.makecode.com/u/GameGod)\
**Post date:** [October 9, 2020, 1:22am UTC](https://forum.makecode.com/t/gravity-formula/3821/3 "2020-10-09T01:22:12Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![purna079](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/purna079/32/4018_2.png) [@purna079](https://forum.makecode.com/u/purna079)\
**Post date:** [October 9, 2020, 2:26pm UTC](https://forum.makecode.com/t/gravity-formula/3821/4 "2020-10-09T14:26:41Z")

</div>

> [@GameGod](#):
>
> x blocks high?

what is the value of x?

---

<div class="post-metadata">

**Author:** ![GameGod](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/gamegod/32/2756_2.png) [@GameGod](https://forum.makecode.com/u/GameGod)\
**Post date:** [October 9, 2020, 2:28pm UTC](https://forum.makecode.com/t/gravity-formula/3821/5 "2020-10-09T14:28:09Z")

</div>

Just x. You plug it into the formula.

---

<div class="post-metadata">

**Author:** ![Dreadmask197](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/dreadmask197/32/10494_2.png) [@Dreadmask197](https://forum.makecode.com/u/Dreadmask197)\
**Post date:** [October 9, 2020, 4:30pm UTC](https://forum.makecode.com/t/gravity-formula/3821/6 "2020-10-09T16:30:03Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![richard](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/richard/32/5417_2.png) [@richard](https://forum.makecode.com/u/richard)\
**Post date:** [October 9, 2020, 4:37pm UTC](https://forum.makecode.com/t/gravity-formula/3821/7 "2020-10-09T16:37:24Z")

</div>

Here’s the formula:

`JUMP_VELOCITY = - squareRoot(2 * GRAVITY * JUMP_HEIGHT)`

In blocks:

 ![Screen Shot 2020-10-09 at 9.36.49 AM](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/2X/1/1b71b325c08c70489f74d096bf78b4627f87f975.png)
