I found code online for creating virtual keys.
My main object moves up, down, left, right using arrow keys in its keyboard events.
I made an invisible object with this codes:
step event:
global.vkup = YoYo_AddVirtualKey(400, view_yview+320, 64, 64, vk_up );
YoYo_ShowVirtualKey( global.vkup );
global.vkright = YoYo_AddVirtualKey( 464, view_yview+340, 64, 64, vk_right );
YoYo_ShowVirtualKey( global.vkright );
global.vkdown = YoYo_AddVirtualKey( 400, view_yview+364, 64, 64, vk_down );
YoYo_ShowVirtualKey( global.vkdown );
global.vkleft = YoYo_AddVirtualKey( 336, view_yview+340, 64, 64, vk_left );
YoYo_ShowVirtualKey( global.vkleft );
Draw event:
draw_sprite(spr_Up,-1,400, view_yview+320);
draw_sprite(spr_Right,-1,464, view_yview+340);
draw_sprite(spr_Down,-1,400, view_yview+364);
draw_sprite(spr_Left,-1,336, view_yview+340);
The problem is that the arrows appear on screen, but touching them has no effect.
I have struggled with this problem for a whole week.
Thank you.
Edited by peter879, 03 May 2012 - 12:37 PM.











