mar_cuz
Member
Hi All,
I'm trying to have my player move with the left stick of a game pad but back and forth on one angle only. So the angle can be:
I only want to move on that axis (push_angle) back and forth and the player cannot move from that angle, so if push left, the player will travel left, but on the specified angle. please see the attached picture demonstrating better. I only want to move back and forth along the push_angle.
my movement code:
please help.
thanks.
I'm trying to have my player move with the left stick of a game pad but back and forth on one angle only. So the angle can be:
Code:
push_angle = point_direction(oGoal.x,oGoal.y, x,y);
my movement code:
Code:
var push_angle = point_direction(oGoalTarget.x,oGoalTarget.y,x,y);
var h_move = gamepad_axis_value(pad_num, gp_axislh);
var v_move = gamepad_axis_value(pad_num, gp_axislv);
var pdir = point_direction(0, 0, h_move, v_move);
if (h_move != 0 && v_move !=0) {
speed = 2;
direction = push_angle;
}
please help.
thanks.
Attachments
-
7.5 KB Views: 4