Game Maker Studio: (Part 3) How to Create Virtual Keys for Android?
Visit my MC GAMES site: https://mcolverdesigns.itch.io
Paypal Donate: http://bit.do/fkPAb
Updated: 12/5/20: GMS File: https://bit.ly/2JLPZXP
New video is coming soon on Virtual Keys. Dealing with alignment issues, and how to make Virtual Keys go away, and come back after pressing a button.
(Note:) When you delete Virtual Keys, they will return, even if they are not active. It would be good practice to do this...
fkey = virtual_key_add(0,0,0,0, vk_enter);///make all numbers at zero.
virtual_key_delete(fkey);
That way the virtual key that is deleted will not interfere with other buttons, if say you slide your fingers on both buttons, where one is active and the other is not.
Resources:
GUI Location: https://bit.ly/37ffQNM
GUI Size: https://bit.ly/2tNxZos
Virtual Key Add: https://bit.ly/2SdPcR2
Code:
obj_fire, Depth -500
Events:
Create
Actions:
fkey = virtual_key_add(3110,2700,400,400, vk_enter);
virtual_key_show(fkey);
Events:
Draw GUI
Actions:
display_set_gui_size(view_wview[0]+2464, view_hview[0]+1472);
Events:
Draw
Actions:
draw_sprite(sprite_index,image_index,view_xview[0]+2464,view_yview[0]+1472);
obj_not_fire, Depth -500
Events:
Create
Actions:
fkey = virtual_key_add(3110,2700,400,400, vk_enter);
virtual_key_delete(fkey);
Events:
Draw
Actions:
draw_sprite(sprite_index,image_index,view_xview[0]+2464,view_yview[0]+1472);
Events:
Draw GUI
Actions:
display_set_gui_size(view_wview[0]+2464, view_hview[0]+1472);
obj_pause, Depth -400
Events:
Left Pressed
Actions:
instance_deactivate_all(true);
instance_activate_object(obj_back);
instance_activate_object(obj_marker);
instance_activate_object(obj_pause_it);
obj_back, Depth -400
Events:
Left Pressed
Actions:
instance_activate_all();
instance_deactivate_object(obj_pause_it);