Y
Yvalson
Guest
its extremely annoying to have to type out device_mouse_x_to_gui(0) 5 times
is there a way I can do this and have it onces for all the buttons
is there a way I can do this and have it onces for all the buttons
but how can I store 5 in 1 variable?Store the result in a global variable in Begin step event and then reference that variable everywhere else
I can't use a for loop because I don't use device_mouse_x_to_gui like that in my code I use it like this:Use a for loop?
Code:for (var i = 0; i < 5; i++;) { if device_mouse_x_to_gui(i) { // Do something } }
if(global.Pausing && !global.In_Store){
if (point_in_rectangle(device_mouse_x_to_gui(0), device_mouse_y_to_gui(0), 352, 192, 544, 384)){
}
else if (point_in_rectangle(device_mouse_x_to_gui(0), device_mouse_y_to_gui(0), 704, 96, 896, 384)){
}
You can't. But why can't you wrap your code in the for loop with a break if necessary to stop iterating?I can't use a for loop because I don't use device_mouse_x_to_gui like that in my code I use it like this:
my question is if I can replace the 0 with something like all to get it to workCode:if(global.Pausing && !global.In_Store){ if (point_in_rectangle(device_mouse_x_to_gui(0), device_mouse_y_to_gui(0), 352, 192, 544, 384)){ } else if (point_in_rectangle(device_mouse_x_to_gui(0), device_mouse_y_to_gui(0), 704, 96, 896, 384)){ }
for (var i = 0; i < 5; i++)
{
if(global.Pausing && !global.In_Store){
if (point_in_rectangle(device_mouse_x_to_gui(i), device_mouse_y_to_gui(i), 352, 192, 544, 384)){
...
break;
}
else if (point_in_rectangle(device_mouse_x_to_gui(i), device_mouse_y_to_gui(i), 704, 96, 896, 384)){
...
break;
}
}
You can still use a loop...I can't use a for loop because I don't use device_mouse_x_to_gui like that in my code
if(global.Pausing && !global.In_Store)
{
for (var i = 0; i < 5; i++;)
{
var _mx = device_mouse_x_to_gui(i);
var _my = device_mouse_y_to_gui(i);
if point_in_rectangle(_mx, _my, 352, 192, 544, 384)
{
//
break;
}
else if point_in_rectangle(_mx, _my, 704, 96, 896, 384))
{
//
break;
}
}
}
because I'm making a mobile game in which the player might (may it be by accident) use his 3rd finger while the other 2 are still on the screen in that case only using [0] would unable to person to pause the game so I like to make my game detect as much fingers as possible in the case of the pauseOff topic marginally but can someone explain why you would need to do that - seems to work fine for with purely (0) in windows using a usb mouse. What are the other 4?
alright well thanks it works really well still don't like the fact that you have to go through such a hurdle if there could just be a simple any but digress. thank youYou can still use a loop...
Code:if(global.Pausing && !global.In_Store) { for (var i = 0; i < 5; i++;) { var _mx = device_mouse_x_to_gui(i); var _my = device_mouse_y_to_gui(i); if point_in_rectangle(_mx, _my, 352, 192, 544, 384) { // break; } else if point_in_rectangle(_mx, _my, 704, 96, 896, 384)) { // break; } } }
could you tell me what #macro means?#macro MouseX device_mouse_x_to_gui(0)
#macro MouseY device_mouse_y_to_gui(0)
http://docs2.yoyogames.com/index.html?page=source/_build/3_scripting/3_gml_overview/6_scope.htmlcould you tell me what #macro means?
I don't use GameMaker Studio 2 so I don't think that's relevant to me
oww lol thought it was a gm2 thing because he posted doc2 in a topic stated using 1.4 anyway ill look into it