• 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!

Legacy GM Need Help with Virtual Keys in Mobile Game

T

TInteractive

Guest
~So I am developing a mobile game through GM:Studio, but I am having some issues. I am going to try and make is a clear as possible: There is a start button on my game and I placed a virtual key to cover it. When I try it on one phone it is positioned correctly, but when I try it on a different phone the virtual key changes position significantly. I figured this was because phones have different resolutions but I still don't know how to fix it. Someone told me to use window_get_height() but that didn't really work. I would also appreciate further help since I am trying to publish this game.~

UPDATE: I created an object, checked "persistent" and in the create event wrote display_set_gui_size([widht], [height]). Then I created the virtual key in a Draw GUI event in the object and it seemed to worked on both devices I am testing. The problem is I want to delete the virtual key at a point but because it is in the draw event it doesn't seem possible. Is there a way to fix this? Maybe a loophole that allows me to delete the virtual key while in the draw GUI event? Or another way to fix that doesn't include writing the key in the draw GUI? Please I would really appreciate any help. Thanks.
 
Last edited by a moderator:
S

ScaryPotato

Guest
What about adding a variable for the button so it only reacts to input when you want?

if buttonactive=true
{do buttony things;}
 
T

TInteractive

Guest
What about adding a variable for the button so it only reacts to input when you want?

if buttonactive=true
{do buttony things;}
I think I see what you mean. What I tried was that after I release the virtual key I would create a loop that deleted the virtual key:
Code:
//in Draw GUI event
enter_key = virtual_key_add(x, y, sprite_width, sprite_height, vk_enter);
//virtual_key_show(enter_key);
Code:
//in release <Enter> event
while(room = rm_start)
{
    virtual_key_delete(enter_key);
}
Unfortunately, when I tried this, the game froze when I released the virtual key. Maybe change the while loop? If your buttonactive thing is different, can you elaborate?
 
S

ScaryPotato

Guest
I was thinking that you could set a variable to limit when input from the button is used, which was different than actually getting rid of the button altogether.
I'm not very familiar with virtual buttons, but I think the problem with your example is that your Enter_Key variable is adding the virtual button. So while you're in rm_start, you're basically trying to delete something before it gets added.
 
Top