S
Smidger
Guest
Hi everyone,
I've looked over many GML scripts and suggestions from the generous community here, but haven't found one that helps me to limit the range of my cursor aim object in a twin stick shooter. It basically means that at present, the cursor object can be at the far end of the viewport, which makes it difficult to quickly alter the direction.
I have the following code, which seems to be working pretty well, but I'd like the cursor to be closer to the player for quick direction changes. If anyone knows of a way to set the range as a radius value around the player, that would be most appreciated.
//STEP EVENT for o_player
scrollSpeed = 30;
if (gamepad_is_connected(0))
{
if ((gamepad_axis_value(0,gp_axisrh) >= 0.5) || (gamepad_axis_value(0,gp_axisrv) >= 0.5)
|| (gamepad_axis_value(0,gp_axisrh) <= -0.5) || (gamepad_axis_value(0,gp_axisrv) <= -0.5))
{
input_h = gamepad_axis_value(0,gp_axisrh);
input_v = gamepad_axis_value(0,gp_axisrv);
cursor_x = window_mouse_get_x() + input_h * scrollSpeed;
cursor_y = window_mouse_get_y() + input_v * scrollSpeed;
window_mouse_set(cursor_x, cursor_y);
}
}
I've looked over many GML scripts and suggestions from the generous community here, but haven't found one that helps me to limit the range of my cursor aim object in a twin stick shooter. It basically means that at present, the cursor object can be at the far end of the viewport, which makes it difficult to quickly alter the direction.
I have the following code, which seems to be working pretty well, but I'd like the cursor to be closer to the player for quick direction changes. If anyone knows of a way to set the range as a radius value around the player, that would be most appreciated.
//STEP EVENT for o_player
scrollSpeed = 30;
if (gamepad_is_connected(0))
{
if ((gamepad_axis_value(0,gp_axisrh) >= 0.5) || (gamepad_axis_value(0,gp_axisrv) >= 0.5)
|| (gamepad_axis_value(0,gp_axisrh) <= -0.5) || (gamepad_axis_value(0,gp_axisrv) <= -0.5))
{
input_h = gamepad_axis_value(0,gp_axisrh);
input_v = gamepad_axis_value(0,gp_axisrv);
cursor_x = window_mouse_get_x() + input_h * scrollSpeed;
cursor_y = window_mouse_get_y() + input_v * scrollSpeed;
window_mouse_set(cursor_x, cursor_y);
}
}