I
innercitysumo
Guest
Hi,
Brand new here and at coding (please be gentle). I'm having some difficulties adding the virtual controls to my app in Android - the virtual key position doesn't seem to tally in any logical way to my object.
To get things tested I'm just trying to add a single key action (vk_left) to the large square at the bottom of the screen (as below). However, when run on my phone the action only works in the smaller square above and off to the left.
Room size = 4096 x 4096
View in room / Port on screen = 1024 x 768
The view is set to follow a ship object
The sprite for the virtual key is 206 x 205 (origin is centered 103, 102)
Code as follows:
Virtual key object
- Create event
- Draw event
(The draw event I put in to stop it lagging when the view was moved, which my separate HUD object was doing until it was added)
The virtual key object is placed in my room at 40,512.
The phone I'm testing it on is a Nexus 5 (1920x1080 resolution).
Any assistance gratefully received, thanks.
Brand new here and at coding (please be gentle). I'm having some difficulties adding the virtual controls to my app in Android - the virtual key position doesn't seem to tally in any logical way to my object.
To get things tested I'm just trying to add a single key action (vk_left) to the large square at the bottom of the screen (as below). However, when run on my phone the action only works in the smaller square above and off to the left.
Room size = 4096 x 4096
View in room / Port on screen = 1024 x 768
The view is set to follow a ship object
The sprite for the virtual key is 206 x 205 (origin is centered 103, 102)
Code as follows:
Virtual key object
- Create event
Code:
global.key_left = virtual_key_add(x-(sprite_height/2),y-(sprite_height/2),sprite_width,sprite_height,vk_left);
Code:
draw_sprite_ext(sprite_index,image_index,view_xview[0]+143,view_yview[0]+614,image_xscale,image_yscale,image_angle,image_blend,image_alpha);
The virtual key object is placed in my room at 40,512.
The phone I'm testing it on is a Nexus 5 (1920x1080 resolution).
Any assistance gratefully received, thanks.
Last edited by a moderator: