• 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] Function explanation needed

Status
Not open for further replies.
Level 3
Joined
Nov 12, 2010
Messages
43
Hi guys , this is my doubt :

in the function

JASS:
native Rect takes real minx, real miny, real maxx, real maxy returns rect
- How do i get values for :
real minx
real miny
real maxx
real maxy
For a rect with
Width = 1280
Height = 640

for any (x,y) in the map
thanks for the answers :ogre_haosis:
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
If you want the center to be at (x, y), then:
  • minX = x - 640
  • maxX = x + 640
  • minY = y - 320
  • maxY = y + 320

Because, let's say the center is at (640, 320):

minX = 0
maxX = 1280
minY = 0
maxY = 640

You can see where this leads to...
maxX - minX = width = 1280
maxY - minY = height = 640


In general, a rect with width "Width" and height "Height" and center (x, y):
  • minX = x - Width/2
  • maxX = x + Width/2
  • minY = y - Height/2
  • maxY = y + Height/2
 
Status
Not open for further replies.
Top