Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Number of Pixels of the title box

Does anyone know the number of pixels of the title box that gives you the option of new game, continue or shutdown? I want to shift it over to the bottom right corner, but I don't know what values to put because I don't know how many pixels the box is, therefore I cannot make the calculations.

# Make command window
s1 = "New Game"
s2 = "Continue"
s3 = "Shutdown"
@command_window = Window_Command.new(192, [s1, s2, s3])
@command_window.back_opacity = 160
@command_window.x = 320 - @command_window.width / 2
@command_window.y = 288
That's my script. Is the number of pixels 192? or is it 160? What does the window width mean?

I would normally just tweak things until I got something I like, but since these are scripts (which are vital to the game) I'd rather not take that chance...
 
You can change these two lines to put it exactly in the bottom right:

@command_window.x = 640 - @command_window.width
@command_window.y = 480 - @command_window.height

The full screen is 640x480, so offsetting it by the width and height will fit it snugly into the corner, no matter the size. You can adjust the two numbers to give it some padding away from the edge if you like as well (say, 635 and 475).
 
Try

@command_window.x = 120 - @command_window.width / 2
@command_window.y = 320

that should put it into the bottom corner

edit: almost forgot. 192 is the width of the box i.e how long it is horizontally and the 160 is the opacity of the box.
 
@ Deltree:

Hmm...That doesn't seem to work for me.

If I put the values at 640 and 480, it makes only half the box show, which leads me to believe that it's like when you add a picture, the coordinates are for the center of the image.

@ bulls84:

Wrong corner :P

Besides, that's too far out, I want the sides of the box to touch the sides of the screen.

I got it though, I changed the x to 545 and the y to 354. It makes the white lines around the box line up 1 pixel before the edge of the screen, which is what I wanted.

Thanks for the help guys.
 
Are you sure you didn't leave the "/ 2" at the ends of the lines? That'd cut it off for sure. It worked when I tested it, and windows always have an origin at the top left unless something is changed way down at the base level.

(Just for my curiosity. Using magic numbers is fine for the solution, but if you decided to change the size down the road you'd have to compensate for that.)
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top