• 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 How do I make a button with draw_rectangle and room_view?

Status
Not open for further replies.

Dr_Nomz

Member
So I have this button:
Code:
if (abs(mouse_x - x) < 50) && (abs(mouse_y - y) < 50) && showInv == true{
  draw_set_color(c_white);
  draw_rectangle(x-47,y-47,x+46,y+46,0)
That basically allows it to draw a rectangle whenever it's hovered over, and then it allows you to click on it, which executes some code.
The above draws the rectangle so this can happen.

I also want the button to appear at specific coordinates based on the room view.
Like with this code, for example:
Code:
  var x1,x2,y1,y2;
  x1 = view_xview[0];
  x2 = x1 + view_wview[0];
  y1 = view_yview[0];
  y2 = y1 + 104;
Which is the code for drawing the Inventory object at the correct position on the screen.

So how do I combine them to make a working button?

I've tried several combinations to get it working, but none of them have worked so I'm asking here.
 
Status
Not open for further replies.
Top