• 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.
  • 💡 We're thrilled to announce that our upcoming texturing contest is in the works, and we're eager to hear your suggestions! Please take this opportunity to share your ideas in this theme discussion thread for the Texturing Contest #34!
  • 🏆 Hive's 7th HD Modeling Contest: Icecrown Creature is now open! The frozen wastes of Icecrown are home to some of Azeroth’s most terrifying and resilient creatures. For this contest, your challenge is to design and model a HD 3D monster that embodies the cold, undead, and sinister essence of Icecrown! 📅 Submissions close on April 13, 2025. Don't miss this opportunity to let your creativity shine! Enter now and show us your frozen masterpiece! 🔗 Click here to enter!

[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