# Maths enquires

#### wraithseeker

##### Tired.
JASS:
``````library VerticalJump uses AutoIndex

//=================================================================
//                  HOW TO USE ?
//=================================================================
//
//  function ThrowUnitToAir takes unit u, real velocity returns nothing
//
//     -This is used to throw unit in to the air
//
//
//  function SetUnitGravity takes unit u, real gravity, returns nothing
//
//    - this can be used to change untis gravity
//    - use it only after you have called ThrowUnitToAir
//
//
//=================================================================
//                 SYSTEM CODE:
//=================================================================

globals
private constant real TIMEOUT = 0.03
private constant real DEFAULT_GRAVITY = 1. // notice this as gravity
private constant integer FLY_ID = 'Amrf'
private timer Timer = CreateTimer()
private integer Count = 0
private group HitGroup = CreateGroup()
private integer array FlyZ
endglobals

struct VelocityJump
unit target
real positionZ
real velocityZ
real gravity

static method create takes unit u, real velocity returns VelocityJump
local VelocityJump d = VelocityJump.allocate()
set d.target = u
set d.velocityZ = velocity
set d.gravity = -(DEFAULT_GRAVITY/2.)
call UnitRemoveAbility(u,FLY_ID)
return d
endmethod

method onDestroy takes nothing returns nothing
call GroupRemoveUnit(HitGroup,.target)
endmethod
implement AutoData
endstruct

private function Periodic takes nothing returns nothing
local integer i = 0
local VelocityJump d
loop
exitwhen i &gt;= Count
set d = FlyZ<i>
set d.velocityZ= d.velocityZ+ d.gravity
set d.positionZ= d.positionZ+ d.velocityZ
set d.velocityZ= d.velocityZ+ d.gravity
call SetUnitFlyHeight(d.target,d.positionZ,0.0)
if d.positionZ &lt;= 0.0 then
call d.destroy()
set Count = Count - 1
if Count &gt; 0 then
set FlyZ<i> = FlyZ[Count]
set i = i - 1
else
call PauseTimer(Timer)
endif
endif
set i = i + 1
endloop
endfunction

function ThrowUnitToAir takes unit u, real velocity returns nothing
local VelocityJump d
if IsUnitInGroup(u,HitGroup) then
set d = VelocityJump<u>
set d.velocityZ = d.velocityZ+velocity
else
if Count == 0 then
call TimerStart(Timer,TIMEOUT,true,function Periodic)
endif
set d = VelocityJump.create(u,velocity)
set VelocityJump<u> = d
set FlyZ[Count] = d
set Count = Count + 1
endif
endfunction

function SetUnitGravity takes unit u, real gravity returns nothing
local VelocityJump d = VelocityJump<u>
if IsUnitInGroup(u,HitGroup) then
set d.gravity= -(gravity/2.)
endif
endfunction

function IsUnitFlying takes unit u returns boolean
return IsUnitInGroup(u,HitGroup)
endfunction

endlibrary</u></u></u></i></i>``````

Am I doing the maths right for this system? I use this system for vertical jumps only.

#### Rainther

##### I guess I should write something of value here...
JASS:
``````local integer Max = Count
local real Hei = 500
local real Raise = ( ( Max + 1 - Count ) / Max )
local real Fly = ( Hei * Raise ) - ( Hei * Raise * Raise )
call SetUnitFlyHeight(d.target,Fly,0.0)``````

If you want the height to be based on the distance, simply change Hei to ( DistanceBetweenPointsBJ * 2 ) for instance

General chit-chat
Help Users
• No one is chatting at the moment.
• C Cherry.Grove:
So what's the whole reforged situation? Do we have to run the classic version bootleg now?
• C Cherry.Grove:
My boyfriend is super into Bethesda modding so I'm probably going to join him in that for a bit, then move on to making mobile/browser games.
• C Cherry.Grove:
I mostly just want to look at my old projects because I know I posted uploads on here somewhere.
• C Cherry.Grove:
My one game was basically Among Us but you sabotaged an entire medieval city simulated drastically inefficiently with dynamic NPCs :S
• C Cherry.Grove:
of course I never finished it x D
• jonas:
xD
• jonas:
I think you can still run the original game, just there's a chance your map won't work with the newer patches
• jonas:
what development framework have you been looking at for mobile development?
• jonas:
I'm currently creating (as a hobby) a space invaders like game for mobile using Xamarin, after starting a few larger projects that I also may not have finished
• The Helper:
Awesome! you should look at the Atari VCS platform it does not have a huge user base but the one it has is super active at around 11k and they have no games in there store
• The Helper:
basically it is linux
• The Helper:
OMG it is BanLord as Blackveiled on the forum
• The Helper:
what is up buddy
• jonas:
thanks for the tip, that sounds cool. Never heard about the VCS before but seems like it should be a good match
• tom_mai78101:
The winter vacation left a toll on me. I missed staying up late and sleeping in late.
• C Cherry.Grove:
i haven't looked into it yet
• C Cherry.Grove:
If I could use something Python compatible it would save me some learning
• C Cherry.Grove:
But Unity might be easiest
• C Cherry.Grove:
looking at old posts here makes me happy. Makes me be all like "wow I was pretty smart in 2009"
• C Cherry.Grove:
mostly failing at life through adulthood really demotivated me for a while
• C Cherry.Grove:
....what I don't get is why the fuck they would force us to permanently convert to a version of the game everyone fucking hated : \
• C Cherry.Grove:
Raid Shadow Legends texture pack smh
• jonas:
Most people fail at life throughout their adulthood. Sometimes we get to learn from it. Usually it just feels like crap.
• The Helper:
What does not kill you makes you stronger is what they say

### Members online

No members online now.