• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!
  • Hello [name]! Thanks for joining the GMC. Before making any posts in the Tech Support forum, can we suggest you read the forum rules? These are simple guidelines that we ask you to follow so that you can get the best help possible for your issue.

Windows How does one COMPLETELY cover one sprite with another?

D

DBabicius

Guest
Hello there!

I'm adapting my grid-based mobile game for PC, and I have a simple question - how does one completely covers one square sprite with another?

Here's the gif on my game's gameplay on mobile. The game is basically played on 7x7 grid. Now when I started adapting the game for PC, here's what I noticed:

upload_2017-3-21_6-49-21.png

As you can see, there is a small approximately 1 pixel sideline that appears next to Character sprite, as if the tile is protruding from beneath. This may be fixed by turning the pixel interpolation off, but it makes the other sprites look a bit blocky and ugly.

Any suggestions on how to fix this? I would be grateful for your help!
 
L

Lysho

Guest
You can make the character sprite one pixel wider and taller? It may have to do with different resolutions on the computer screen/mobile? Maybe that one pixel wasn't visible before, or on the stretched screen of the computer, it's become apparent. When adapting sprites to different resolutions, there is often some underlying sprite work needed to make it look just as clean on both platforms.
 
D

DBabicius

Guest
Thanks for the suggestion, Lysho.

Well both the character, the tile and all other objects are of the same size 100x100 px with 3 px border gap on each of the four sides. Making hero one px wider does hardly solve the issue, since it neither makes the sizes the same (because the already are) nor hides that nasty line. I'm almost certain this bug comes from the combination of interpolation and scaling, but turning pixel interpolation off makes all other sprites rather unpleasant looking, and, if I'm not mistaken, interpolation cannot be used on a separate sprite, especially if this sprite is drawn on a surface.

I think that at his juncture the only way is to start using shaders for tile drawing, a decision which I have been dreading, since I know nothing about the shaders. :( Maybe somebody would recommend a good tutorial?
 

Tsa05

Member
Is there a way to calculate the exact size of your grid cells after scaling?
If so, you could scale your character sprite to the next whole pixel larger
 

Perseus

Not Medusa
Forum Staff
Moderator
I'm almost certain this bug comes from the combination of interpolation and scaling, but turning pixel interpolation off makes all other sprites rather unpleasant looking, and, if I'm not mistaken, interpolation cannot be used on a separate sprite, especially if this sprite is drawn on a surface.
If you're certain that turning pixel interpolation off fixes the issue, you can turn it off via texture_set_interpolation prior to drawing the player sprite, then turn it back on aftwerwards.

Code:
texture_set_interpolation(false);
draw_self();
texture_set_interpolation(true);
 
Top