J
jana
Guest
You can change the sub-image of an object that's on a path, can't you? My code doesn't seem to be working.
I want to change the sub-image based on which direction the object is moving in the path --- up, down, left, right.
This is in the create event:
This is in the step event. I tried it in both begin step and step:
The sub-image doesn't change when the object changes direction in the path.
Am I missing something?
I want to change the sub-image based on which direction the object is moving in the path --- up, down, left, right.
This is in the create event:
Code:
image_index = 1;
image_speed = 0;
Code:
var proper_image_index = -1;
if(xprevious < x)
{
proper_image_index = 0;
if (proper_image_index != image_index)
{
image_index = proper_image_index;
}
}
else
{
if(xprevious > x)
{
proper_image_index = 2;
if (proper_image_index != image_index)
{
image_index = proper_image_index;
}
}
else
{
if(yprevious < y)
{
proper_image_index = 3;
if (proper_image_index != image_index)
{
image_index = proper_image_index;
}
}
else
{
if(yprevious > y)
{
proper_image_index = 1;
if (proper_image_index != image_index)
{
image_index = proper_image_index;
}
}
}
}
}
Am I missing something?