T
trentallain
Guest
In my game I want it so if I am holding right click on a mouse or L2 (gp_shoulderlb) on a controller, it will slowly move the camera towards a point (which will be the camera's view width or height/2 past the camera's target object, with an angle up to 360 degrees). And if I release right click or L2, then it will slowly go back to the normal target object.
The above code kind of works for the right click atm (but snaps to positions)
So my questions are:
How do I get it to work with camera_aim_direction and not snap to positions?
Code:
if obj_control.controller_connected == true
{
if gamepad_axis_value(gp_type,gp_axisrh) != 0 and gamepad_axis_value(gp_type,gp_axisrv) != 0
{
var gp_h_axis_dir = sign(gamepad_axis_value(gp_type,gp_axisrh))
var gp_v_axis_dir = sign(gamepad_axis_value(gp_type,gp_axisrv))
right_axis_direction = floor(point_direction(0,0,gp_h_axis_dir,gp_v_axis_dir))
}
camera_aim_direction = right_axis_direction
}
else
{
camera_aim_direction = floor(point_direction(0,0,mouse_x,mouse_y))
}
if obj_control.inventory_open == 0 && obj_control.menu_open == 0
{
if mouse_check_button(mb_right) || (obj_control.controller_connected == true && gamepad_button_check(obj_control.gp_type,gp_shoulderlb))
{
if !keyboard_check(ord("1")) && !keyboard_check(ord("2")) && !keyboard_check(ord("3"))
{
//Aiming
view_target_x = floor(x - camera_get_view_width(obj_control.camera)/2 - (x-mouse_x)/4)
view_target_y = floor(y - camera_get_view_height(obj_control.camera)/2 - (y-mouse_y)/4)
camera_set_view_pos(obj_control.camera,view_target_x,view_target_y)
}
}
else
{
camera_set_view_pos(obj_control.camera,x-camera_get_view_width(obj_control.camera)/2,y-camera_get_view_height(obj_control.camera)/2)
}
}
So my questions are:
How do I get it to work with camera_aim_direction and not snap to positions?