Roastedzerg
Member
I'm trying to make the joystick movement and aiming in my game butter smooth so the slightest tweak in the joystick will slightly turn the player in a direction incrementally. However, most of the joystick stuff i could find for game maker is the same and has a problem with having a sort of deadzone with the cardinal directions (up, down, left, right). And i dont mean incremental speed adjustment like walking to jogging, but adjustment to movement or aiming direction.
Example: if i hold left on the joystick, then slightly move the joystick upwards, he will ignore the slight adjustment, moving straight left, until the joystick leaves what feels like some kind of deadzone above and below perfect left.
How do i make a more accurate joystick adjustment?
Heres what ive got so far for the aiming:
Example: if i hold left on the joystick, then slightly move the joystick upwards, he will ignore the slight adjustment, moving straight left, until the joystick leaves what feels like some kind of deadzone above and below perfect left.
How do i make a more accurate joystick adjustment?
Heres what ive got so far for the aiming:
GML:
//Gamepad Movement
if(!is_dodging){scr_move_axis(xaxis,yaxis,gamepad_get_axis_deadzone(gamepad_device),x_speed_max);}
//scr_move_axis
xaxis=argument0
yaxis=argument1
threshold=argument2
magnitude=point_distance(0,0,xaxis,yaxis)
spd=argument3
if(can_move)
{
if(!is_dodging&&hor_move==0&&vert_move==0)
{
if(magnitude>=threshold)
{
x_speed+=xaxis*spd;
y_speed+=yaxis*spd;
}
}
}
//Joystick aiming
if(xaxis_aim!=0||yaxis_aim!=0)
{
use_mouse=false;
var pdir=point_direction(0,0,xaxis_aim,yaxis_aim);
var dif=angle_difference(pdir,aim_angle);
aim_angle+=median(-20,dif,20);
}
Last edited: