T
TheCatWithHands
Guest
I'm trying to make point and click. For moving I use this:
Global Mouse Left Pressed
target_x = mouse_x;
target_y = mouse_y;
Step
if(target_x != 0 && target_y != 0) {
move_towards_point(target_x, target_y, spd);
if(point_distance(x, y, target_x, target_y) < spd + 2) {
speed = 0;
exit;
}
And it works correctly.
But I have problems with walls. I added this:
if (place_meeting(x + spd, y + spd, obj_walls)) {
speed = 0;
}
Object stops, but after he sticks and doesn't react any mouse's click. I think problem is the condition place_meeting(x + spd, y + spd, obj_walls) is always true after meeting the wall, but I have no idea how to fix that. I tried to use the variable and change its meaning to start moving again, but it doesn't work. Videos I had seen solved the problem when key-moving was used, I don't unerstand how to employ that in my case (but I tried too).
P.S. I don't have any animation.
Global Mouse Left Pressed
target_x = mouse_x;
target_y = mouse_y;
Step
if(target_x != 0 && target_y != 0) {
move_towards_point(target_x, target_y, spd);
if(point_distance(x, y, target_x, target_y) < spd + 2) {
speed = 0;
exit;
}
And it works correctly.
But I have problems with walls. I added this:
if (place_meeting(x + spd, y + spd, obj_walls)) {
speed = 0;
}
Object stops, but after he sticks and doesn't react any mouse's click. I think problem is the condition place_meeting(x + spd, y + spd, obj_walls) is always true after meeting the wall, but I have no idea how to fix that. I tried to use the variable and change its meaning to start moving again, but it doesn't work. Videos I had seen solved the problem when key-moving was used, I don't unerstand how to employ that in my case (but I tried too).
P.S. I don't have any animation.