S
Slothagami
Guest
I'm making a local co-op game for two players, this is my first time adding touch controls for a game (it's not for a phone, my computer has a touch screen)
I was making a joystick in screen for each player using the dragging event, and only one of the joysticks work at a time, is there a solution to this?
here is my code:
thanks in advance!
I was making a joystick in screen for each player using the dragging event, and only one of the joysticks work at a time, is there a solution to this?
here is my code:
GML:
// o_touchcontrol draw event
//draw circle for the joystidk limits and smaller one for player input place
draw_set_alpha(0.5);
draw_set_color(color);
draw_circle(x, y, touch_radius, true);
draw_circle(touchx, touchy, touch_radius / 4 - (joystick * 4), false);
draw_circle(button_x, button_y, touch_radius / 4 - (button * 4), false);
draw_set_color(c_white);
draw_set_alpha(1);
GML:
// o_touchcontrol drag event
if point_distance(x, y, event_data[? "posX"], event_data[? "posY"]) <= touch_radius {
touchx = event_data[? "posX"];
touchy = event_data[? "posY"];
joystick = true;
}
GML:
// o_touchcontrol drag end event
touchx = x;
touchy = y;
joystick = false;
button = false
Last edited by a moderator: