K3fka
Member
Hey, everyone. I'm having a pretty strange issue involving macros. I want to have four macros: tlx, tly, brx, and bry, which would correspond to top-left and bottom-right coordinates of a sprite (given that the origin is centered).
I'm finding that for the purpose of collisions, I want to subtract 1 from each of these values. Here's where the problem lies. When I subtract 1 from my brx and bry macros, things work well. Here's a screenshot (I'm drawing a rectangle with these macros as the coordinates to demonstrate).
You can see, the right side of the rectangle matches up perfectly with the end of the wall, which is what I want.
However, when I add the subtraction to the other macros as well...
Not only is the left side of the rectangle not moving, but it seems to be affecting the brx macro as well somehow.
Here's my macro code:
Here's my rectangle drawing code:
I appreciate any help you guys can offer me.
I'm finding that for the purpose of collisions, I want to subtract 1 from each of these values. Here's where the problem lies. When I subtract 1 from my brx and bry macros, things work well. Here's a screenshot (I'm drawing a rectangle with these macros as the coordinates to demonstrate).
You can see, the right side of the rectangle matches up perfectly with the end of the wall, which is what I want.
However, when I add the subtraction to the other macros as well...
Not only is the left side of the rectangle not moving, but it seems to be affecting the brx macro as well somehow.
Here's my macro code:
Code:
#macro tlx (x - (abs(sprite_width) / 2) - 1)
#macro tly (y - (abs(sprite_height) / 2) - 1)
#macro brx (x + (abs(sprite_width) / 2) - 1)
#macro bry (y + (abs(sprite_height) / 2) - 1)
Code:
draw_self();
draw_set_color(c_green);
draw_rectangle(tlx, tly, brx, bry, true);