# Height Distance and Stuff

#### BlackRose

##### Forum User
Herro.

Say I got a spell that shoots a fire ball onto the target location.

And my flying height is 700.
The target ground's height is 0.
And the distance I target is only 150 range away.

And the speed of the fireball is 900.

I'm absolelutely terrible and clueless at maths.... dunno how to phrase the question

JASS:
``````function GetLinearHeightByDistance takes real distance, real currDis, real startHeight, real endHeight returns real
return (((distance-currDis) / distance) * startHeight) + endHeight
endfunction``````

Using something like this... but since it's dependent on distance, it will be messed up on very short total distances. I want to calculate both ground distance and height distance.

So my fireball which starts from 700 height will go down to 0 height smoothly

Help please in the most Simple English way possible <3

#### Skippy

##### Active Member
currDis/distance - number from 0 to 1; 0 means start, 1 means end.

So current height can be obtained this way:
JASS:
``startHeight + currDis/distance * (endHeight - startHeight)``

Example: distance = 150, startheight = 700, endheight = 0, currdis = 75
700 + 75 / 150 * (0 - 700) = 700 + 0.5 * (-700) = 350

It should work

#### Chaos_Knight

##### New Member
currDis/distance - number from 0 to 1; 0 means start, 1 means end.

So current height can be obtained this way:
JASS:
``startHeight + currDis/distance * (endHeight - startHeight)``

Example: distance = 150, startheight = 700, endheight = 0, currdis = 75
700 + 75 / 150 * (0 - 700) = 700 + 0.5 * (-700) = 350

It should work
Do you like maths?

#### BlackRose

##### Forum User
Solved.

General chit-chat
Help Users
• No one is chatting at the moment.
• The Helper:
Friday Yay!
• mgarcia:
did you guys catch Carl's interview? https://www.youtube.com/watch?v=kuHiMXABkGs
• mgarcia:
he's the one that informed me about the DVD's working!
• mgarcia:
he also mentioned the progress on the controllers!
• The Helper:
I did actually it was cool to see the NUON mention
• The Helper:
https://discord.com/channels/985377399338332202/985377399950696481 you can still use this chat too we are two fisted now
• thewrongvine:
costs me \$80 to fill gas tank sad face
• Ghan:
Oof
• The Helper:
Yeah that gas is some expensive stuff
• The Helper:
ghan does not have to worry about it he has a tesla and I have a small tank so it does not cost me usually more than 50
• The Helper:
fyi Ghan we are getting an error trying to access stats or world editor tutorials Error 526 Ray ID: 72128c6bf99f6707 • 2022-06-26 02:35:15 UTCInvalid SSL certificate
• Ghan:
An artifact of switching to Cloudflare... the Let's Encrypt certs can't autorenew through Cloudflare.
• Ghan:
I got the forum updated before things expired but there were some other casualties.
• Ghan:
Everything should be fixed now....
• The Helper:
Thank you Ghan!
• The Helper:
Happy Monday!
• The Helper:
new NUON forum mod cubanral!
+1
• The Helper:
• tom_mai78101:
Started learning how to make tools-assisted speedruns, so I'm lately busy.
• tom_mai78101:
Here's my current project.
+3
that was pretty good!
• jonas:
really cool! I saw the game before but always thought it's just a half as good double dragon. Now I realize it actually has a lot of depth!
• The Helper:
I just saw a bunch of running and jumping past all the enemies look like it was scripted as he said I guess I should have watched the whole thing. I only got a couple of minutes in. You should post that video in the forum Tom
• Darthfett:
"Hi in the chat!"
+1
• tom_mai78101:
Currently busy with making the run even better, so I'll post that new one once I'm done. Right now, I had to modify the emulator itself, the tools that makes this video, and some RAM address disassembling / reverse-engineering to get the right values, and such.
+1