• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

GML Drawn Button Origin?

Z

ZanyMechanism

Guest
This is my first post. Hiiiiii! Whenever I try to create this and put the position x=room_width/2 and y=room_width/2, it's not on the center. Please help, here's my code
Code:
draw_rectangle_colour((x-(buttonWidth/2))-2,(y-(buttonHeight/2))-2,(x+(buttonWidth/2))+2,(y+(buttonHeight/2))+7,c_white,c_white,c_white,c_white,0)
Thanks in Advance
 
F

Fodderbot

Guest
Its because you need to get room height instead of width for y (room_height)

skip that I just read your code block, I was going on the description

Are you making an adjustment for the x,y position of the button being in the upper left corner?

you need to adjust for both the room and the button offsets
 
Top