generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: Question about the positioning of GUIs.

Previous Thread :: Next Thread 
Flurite is not online. Flurite
Joined: 03 Apr 2011
Total Posts: 5386
14 Jan 2012 10:46 AM
My question is about the GUI positioning at this place made by Vitos:

http://www.roblox.com/Snake-place?id=12567054

I was interested in the fact that the orange GUI that set the boundaries for the movement of the snake appears in the middle of the screen, no matter what screen size, and the fact that it doesn't get bigger when re-sized. I know you can use scale to set it in the middle of the screen, but using scale will cause the boundaries to get either smaller or larger. I was curious about how Vitos did this. I PMed him, but he hasn't responded yet, and I want a quick answer.

~Flurite
Report Abuse
Flurite is not online. Flurite
Joined: 03 Apr 2011
Total Posts: 5386
14 Jan 2012 10:50 AM
So pretty much the question is how to position and size a GUI in the middle of every screen, and the same size on every screen.

~Flurite
Report Abuse
blocco is not online. blocco
Joined: 14 Aug 2008
Total Posts: 29474
14 Jan 2012 10:57 AM
Position is independent of size.
However, you can size it and then position it based on that with scale, which is relative to the screen's size.
Report Abuse
RATEXmegaGAMER is not online. RATEXmegaGAMER
Joined: 10 Dec 2010
Total Posts: 4046
14 Jan 2012 11:00 AM
Size it to whatever you want using scale and then take away half of the scale size from 0.5 for both X and Y in position?

[The silence answered my question.]
Report Abuse
RATEXmegaGAMER is not online. RATEXmegaGAMER
Joined: 10 Dec 2010
Total Posts: 4046
14 Jan 2012 11:00 AM
Latetoast...

[The silence answered my question.]
Report Abuse
Ryfel is not online. Ryfel
Joined: 03 Jan 2012
Total Posts: 14
14 Jan 2012 11:37 AM
he just used scale of position and offset for size for example

Size=UDim2.new(0,500,0,500)
Pos=UDim2.new(0.5,-250,0.5,-250)
Report Abuse
blocco is not online. blocco
Joined: 14 Aug 2008
Total Posts: 29474
14 Jan 2012 11:41 AM
Ryfel has the correct idea. You see, GUI objects are positioned with a top-left point. Therefore, if you must position it with a center point, you must take the center point and move it up by half the element's height and move it left by half the element's width to get the top-left point.
Report Abuse
Flurite is not online. Flurite
Joined: 03 Apr 2011
Total Posts: 5386
14 Jan 2012 11:46 AM
Hmm.. then if I do use a mix of offset and scale it will be hard to detect colliding GUIs, because I'm pretty sure AbsoluteSize and AbsolutePosition aren't accurate..

~Flurite
Report Abuse
RATEXmegaGAMER is not online. RATEXmegaGAMER
Joined: 10 Dec 2010
Total Posts: 4046
14 Jan 2012 06:15 PM
@Flurite
--This is comparing floats so it might help.

function IsEqual(num1,num2)
    local x = 0.000001
    return math.abs(num1-num2) <= x * math.abs(num1)
end

You can adapt that I guess.
[The silence answered my question.]
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image