DirtyLibrary
Member
I'm trying to create a menu/interface, which is docked at the bottom of the screen and displays sprites all of the buildings the player can create, along with a "purchase" button next to each of the sprites. The player clicks the button to open up the interface, which pops up, but the buttons are only clickable when the mouse is over a certain position? The map moves with viewports when the cursor is near the edge of the screen, so the objects are not always in the same position.
Code that displays the objects on screen:
Draw GUI event:
any advice would be appreciated.
Code that displays the objects on screen:
Code:
var posX = 500;
obj1 = instance_create_layer(100, posX, "GUI", obj_bm_placeholder);
purchase = instance_create_layer(100, posX+30, "GUI", obj_bm_purchase);
obj1.itemID = "palace";
obj2 = instance_create_layer(210, posX, "GUI", obj_bm_placeholder);
purchase = instance_create_layer(210, posX+30, "GUI", obj_bm_purchase);
obj2.itemID = "mineshaft";
obj3 = instance_create_layer(320, posX, "GUI", obj_bm_placeholder);
purchase = instance_create_layer(320, posX+30, "GUI", obj_bm_purchase);
obj3.itemID = "watersupply";
Draw GUI event:
Code:
var spritename = asset_get_index("spr_construction_" + string(itemID));
draw_sprite(spritename, 0, x, y);