dash_state = function(){
if (vel_x > 0) vel_x = -.2;
if (vel_y > 0) vel_y = -.2;
if(input_check("dash")){
if (!instance_exists(Obj_dash_circle) && !instance_exists(Obj_dash_arrow)){
var _dir;
var _circle = instance_create_depth(x, y - 12, -1, Obj_dash_circle);
var _arrow = instance_create_depth(_circle.x, _circle.y, 0, Obj_dash_arrow);
if (gamepad_is_connected(0)){
_dir = point_direction(0, 0, gamepad_axis_value(0, gp_axislh), gamepad_axis_value(0, gp_axislv));
}
else{
_dir = point_direction(_circle.x, _circle.y, mouse_x, mouse_y);
}
var _x = _circle.x + lengthdir_x(_circle.sprite_width/2, _dir);
var _y = _circle.y +lengthdir_y(_circle.sprite_height/2, _dir);
_circle.x = x;
_circle.y = y - 12;
_arrow.image_angle = _dir;
_arrow.x = _x;
_arrow.y = _y;
}
}
else if (input_check_released("dash")){
var _dir;
var _circle = Obj_dash_circle;
if (gamepad_is_connected(0)){
_dir = point_direction(0, 0, gamepad_axis_value(0, gp_axislh), gamepad_axis_value(0, gp_axislv));
}
else{
_dir = point_direction(_circle.x, _circle.y, mouse_x, mouse_y);
}
instance_destroy(Obj_dash_circle);
instance_destroy(Obj_dash_arrow);
vel_x = 0;
vel_y = 0;
can_move = 1.5;
dash_number--;
vel_x = lengthdir_x(dash_spd * sign(_dir), _dir);
vel_y = lengthdir_y(dash_spd * sign(_dir), _dir);
state = free_moviment;
}
}