LazyTomato
Member
Heya! I'm working on a platformer right now, implementing water mechanics to be precise.
What i'm doing here is using "water blocks" to mark the areas that are going to be filled with water, stretching them out, and then these blocks will draw a semi-transparent rectangle over the area they cover. So far so good, it works out perfectly.
...Except for one problem i'm having.
Since these blocks are square, i need to use multiple ones to fill in specific sections of water when the basic shape doesn't quite make the cut.
Here's an example of what i'm doing, in the room editor:
As you can see, it's a bigger water block on the left filling in the bigger vertical area, and then a second smaller water block to fill in this lower exit i've placed.
The positioning itself is perfect, and the horizontal scale of each of these blocks is also perfect integer numbers (the basic scale of each block being 64x64).
However, when i actually run the game itself, the drawing seems to be misaligned, and there's a 1-pixel overlap between the two blocks, even if it's not visible in the room editor:
(ignore the graphics, it's all placeholders for now; also the little top part of the water is an additional piece of code that draws a looping surface sprite above the water block)
As you can see, even though the positioning is pixel-perfect and there's seemingly nothing that should go wrong here, the overlap is still there and looks off with the water's inherent transparency.
Is this some sort of bug in the engine itself? Is there something i could do to fix this?
Here's the drawing code i use in these blocks, by the way:
(there's more code after this for the little extra surface sprites but it's irrelevant to the issue)
It doesn't seem like there should be anything wrong with the code itself, but the problem is still there, and persists even after clearing the asset cache.
I've also tried adding rounding functions to the drawing positions in the code but that doesn't seem to fix the issue either.
What i'm doing here is using "water blocks" to mark the areas that are going to be filled with water, stretching them out, and then these blocks will draw a semi-transparent rectangle over the area they cover. So far so good, it works out perfectly.
...Except for one problem i'm having.
Since these blocks are square, i need to use multiple ones to fill in specific sections of water when the basic shape doesn't quite make the cut.
Here's an example of what i'm doing, in the room editor:
The positioning itself is perfect, and the horizontal scale of each of these blocks is also perfect integer numbers (the basic scale of each block being 64x64).
However, when i actually run the game itself, the drawing seems to be misaligned, and there's a 1-pixel overlap between the two blocks, even if it's not visible in the room editor:
As you can see, even though the positioning is pixel-perfect and there's seemingly nothing that should go wrong here, the overlap is still there and looks off with the water's inherent transparency.
Is this some sort of bug in the engine itself? Is there something i could do to fix this?
Here's the drawing code i use in these blocks, by the way:
Code:
draw_set_alpha(0.47);
watercol=make_color_rgb(0,168,232);
draw_rectangle_color(x,y,x+(image_xscale*64),y+(image_yscale*64),watercol,watercol,watercol,watercol,false);
draw_set_alpha(1);
It doesn't seem like there should be anything wrong with the code itself, but the problem is still there, and persists even after clearing the asset cache.
I've also tried adding rounding functions to the drawing positions in the code but that doesn't seem to fix the issue either.