R
rgamer
Guest
how do i install virtual keys?
Last edited by a moderator:
If you make a call to virtual_key_add, you designate a rectangle on the screen to simulate a key press (you provide which key press is determined by the last argument). If you have an event that reacts to that key press, if you touch the screen in that rectangular location, the program will respond as if you have pressed the equivalent key on a keyboard. The step-by-step is to make that one function call. Done. If you have problems with that to do reacting to input events in general, you should say so, and perhaps start a new topic with specific questionsI've seen several tutorials on how to install as virtual keys, but I'm not getting it. Could someone explain to me how to install and place as steps (step by step) and conclude: why run the buttons to walk left and right, jump and shoot? I appreciate the collaboration.
leftVk = virtual_key_add(0, 920, 160, 160, vk_left);
rightVk = virtual_key_add(1760, 920, 160, 160, vk_right);
shootVk = virtual_key_add(1760, 760, 160, 160, vk_space);
virtual_key_delete(leftVk);
virtual_key_delete(rightVk);
virtual_key_delete(shootVk);
// Left and right virtual keys
draw_set_colour(c_blue);
draw_rectangle(0, 920, 160, 1080, false);
draw_rectangle(1760, 920, 1920, 1080, false);
// Shoot virtual key
draw_set_colour(c_red);
draw_rectangle(1760, 760, 1920, 920, false);
// Text labels
draw_set_colour(c_black);
draw_text(0, 920, "Left");
draw_text(1760, 920, "Right");
draw_text(1760, 760, "Shoot");