Jump to content


Photo

Touchscreen virtual keys problem


  • Please log in to reply
No replies to this topic

#1 peter879

peter879

    GMC Member

  • GMC Member
  • 67 posts
  • Version:GM:Studio

Posted 03 May 2012 - 12:41 AM

I am new to GML, using Gamemaker HTML5.

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.

  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users