• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

JASS Shapes

Status
Not open for further replies.
Level 14
Joined
Jun 27, 2008
Messages
1,325
that kind of stuff is usually done by moving dummyunits which have the model of the desired effects. Moving the units is done by teleporting them periodically (setting their position using a periodic timer with like 0.03 seconds timeout).

To form the shape you just need to find an expression for the x,y,z values (or x(t), y(t), z(t) functions). This requires some basic math knowledge, but nothing difficult.

Example for a circle with radius r u just use x(t) = r * cos(t), y(t) = r * sin(t), to change the angular velocity multiply the argument of sin and cos with a factor.

To make a spiral use the same expressions and add z(t) = t * v_z with v_z being the speed in z direction. Looks like this:
http://www.wolframalpha.com/input/?i=ParametricPlot3d[{Cos[t]%2C+Sin[t]%2C+t%2F6}%2C+{t%2C+0%2C+30}]
 
Level 14
Joined
Jun 27, 2008
Messages
1,325
JASS:
globals
	//counts the steps
	integer i
	//x,y of start position
	real xStart
	real yStart
	//x,y of each step
	real xD
	real yD
	//the dummy
	unit dummyUnit
endglobals

function move takes nothing returns nothing
	if i < 100 then
		set i = i + 1
		call SetUnitX(dummyUnit, xStart + xD * i)
		call SetUnitY(dummyUnit, yStart + yD * i)
	else
		call DestroyTimer(GetExpiredTimer())
	endif
endfunction

function shockwave real x, real y, real angle returns nothing
	set i = 0
	set xStart = x
	set yStart = y
	set xD = cos(angle)
	set yD = sin(angle)
	call TimerStart(CreateTimer(), true, 0.03, function move)
endfunction

math:
x(t) = xStart + xD * t
y(t) = yStart + yD * t
or with vectors:
(x, y)(t) = (xStart, yStart) + (xD, yD) * t
 
Status
Not open for further replies.
Top