F
Firefly042
Guest
Hello, I know this has been asked before, but none of the solutions have worked for me. I have a pretty simple object following a straight, horizontal path.
In the instance creation method, I have:
It works exactly how I expect it to.
And in the object Step event, I have tried:
As hspeed is not being explicitly set when I use a path, it seems.
The issue I'm running into is apparent when I show a debug message at every step:
And the output is:
So it is clearly moving, but there is no difference between x and xprevious. I am confident xprevious isn't being set in any of my other code.
I also tried using the path_speed variable as well, but that does not change at all like how I expect it to. It does change, but not every time the object switches direction on the path. As far as I can tell, it changes once on its second direction switch, but not at all after that.
Does anyone know what is going on here and how I may be able to make this work? Thank you very much and please let me know if more information is needed.
In the instance creation method, I have:
Code:
path_start(path_rescale(straight, -8, 1), movement_speed, path_action_reverse, false);
And in the object Step event, I have tried:
Code:
if (x > xprevious) // moving right
{
show_debug_message("moving right");
image_xscale = 1;
}
else if (x < xprevious) // moving left
{
show_debug_message("moving left");
image_xscale = -1;
}
The issue I'm running into is apparent when I show a debug message at every step:
Code:
show_debug_message("x = " + string(x) + ", xprevious = " + string(xprevious));
Code:
x = 1120, xprevious = 1120
x = 1117, xprevious = 1117
x = 1114, xprevious = 1114
x = 1111, xprevious = 1111
x = 1108, xprevious = 1108
x = 1105, xprevious = 1105
x = 1102, xprevious = 1102
x = 1099, xprevious = 1099
x = 1096, xprevious = 1096
x = 1093, xprevious = 1093
x = 1090, xprevious = 1090
x = 1087, xprevious = 1087
x = 1084, xprevious = 1084
x = 1081, xprevious = 1081
x = 1078, xprevious = 1078
x = 1075, xprevious = 1075
x = 1072, xprevious = 1072
x = 1069, xprevious = 1069
x = 1066, xprevious = 1066
x = 1063, xprevious = 1063
x = 1060, xprevious = 1060
x = 1057, xprevious = 1057
x = 1054, xprevious = 1054
x = 1051, xprevious = 1051
x = 1048, xprevious = 1048
x = 1045, xprevious = 1045
x = 1042, xprevious = 1042
x = 1039, xprevious = 1039
x = 1036, xprevious = 1036
x = 1033, xprevious = 1033
x = 1030, xprevious = 1030
x = 1027, xprevious = 1027
x = 1024, xprevious = 1024
x = 1021.00, xprevious = 1021.00
x = 1018.00, xprevious = 1018.00
x = 1015.00, xprevious = 1015.00
x = 1012.00, xprevious = 1012.00
x = 1009.00, xprevious = 1009.00
x = 1006.00, xprevious = 1006.00
x = 1003.00, xprevious = 1003.00
x = 1000.00, xprevious = 1000.00
x = 997.00, xprevious = 997.00
x = 994.00, xprevious = 994.00
x = 991.00, xprevious = 991.00
x = 988.00, xprevious = 988.00
I also tried using the path_speed variable as well, but that does not change at all like how I expect it to. It does change, but not every time the object switches direction on the path. As far as I can tell, it changes once on its second direction switch, but not at all after that.
Does anyone know what is going on here and how I may be able to make this work? Thank you very much and please let me know if more information is needed.