Notes:
acceleration can be set to anything, but keep it between 0.5 - 2.0 or so.
friction must be between 0.00 and 1.00, but recommended you stay between 0.85 and 0.99.
The trigger:
-
Slide Loop
-
Events
-
Time - Every 0.03 seconds of game time
-
Conditions
-
Actions
-
Unit Group - Pick every unit in sliders and do (Actions)
-
Loop - Actions
-
Set tunit = (Picked unit)
-
Set tid = (Custom value of tunit)
-
-------- move unit --------
-
Custom script: call SetUnitX(udg_tunit, GetUnitX(udg_tunit) + udg_dx[udg_tid])
-
Custom script: call SetUnitY(udg_tunit, GetUnitY(udg_tunit) + udg_dy[udg_tid])
-
-------- perform acceleration --------
-
Set dx[tid] = (dx[tid] + (acceleration x (Cos((Facing of tunit)))))
-
Set dy[tid] = (dy[tid] + (acceleration x (Sin((Facing of tunit)))))
-
-------- apply friction --------
-
Set dx[tid] = (dx[tid] x friction)
-
Set dy[tid] = (dy[tid] x friction)
(using a unit indexing system, not necessary if you only have 1 slider per player)
For collisions, you just accelerate them away from each other, using a higher acceleration.
Set dx[tid] = (dx[tid] + (collisionacceleration x (Cos((angle between units)))))
Set dy[tid] = (dy[tid] + (collisionacceleration x (Sin((angle between units)))))
(and do the same for the other unit, turning it around)
EDIT: If you want more control over the acceleration and friction, you could make a new looping trigger for that with a slower period.
Friction reduces the speed by a factor. This means that eventually the speed loss due to friction is equal to the acceleration, causing a "natural" top speed.