M
MindTrekker201
Guest
I am currently working on a shop system that creates a sprite as big as the window then smaller sprites as the items sold. I am attempting to make it so if I click within an area while the menu is open (and I have enough coins), I will be able to acquire the listed item. here is my current script to accomplish this, in a script called list_shop(x,y,item,price)
for some reason, in game, clicking the area defined above does not activate the instance_create function.
demonium is player object
global.coinum is coin counter
also, the viewport id is 0 and is set to follow the player object.
in code, the function is used as follows.
list_shop(254,128,gem,1)
Code:
if mouse_check_button_pressed(mb_left){
xx=window_view_mouse_get_x(0)
yy=window_view_mouse_get_y(0)
arg0=argument0+256
arg1=argument1+256
if xx>argument0 && xx<arg0 && yy>argument1 && yy<arg1{
if global.coinum>=argument3{
instance_create_depth(demonium.x,demonium.y,1,argument2)
global.coinum-=argument3
}}}
demonium is player object
global.coinum is coin counter
also, the viewport id is 0 and is set to follow the player object.
in code, the function is used as follows.
list_shop(254,128,gem,1)