0
\$\begingroup\$

I am making a game using pyGame; it is basically a space invader game, with a tank.

Game screenshot showing forest scene with a tank sprite inside a white rectangle

As we can see, this tank image I have has white borders / a white background, which I really want to get rid of.

I am thinking of editing it out, but it would be replaced by a different colour. Is there any way to somehow cut out this tank image from its original rectangular box?

\$\endgroup\$
  • \$\begingroup\$ Tip: a "boarder" is someone who is living in your home temporarily. A "border" is a line around the perimeter of a shape. What you have here though isn't just a white outline, the whole background of the sprite is white. \$\endgroup\$ – DMGregory Apr 2 at 11:12
6
\$\begingroup\$

Use a file format that supports alpha (png), an editor that can save it with a transparent background (gimp2, photoshop, basically not paint) and make sure you load the sprite correctly

\$\endgroup\$
  • 1
    \$\begingroup\$ I would like to add that even with all those done correctly, he can have this issue because of a simple mistake: many programs start with another layer which is a white background. Please make sure you remove / make it invisible before exporting. \$\endgroup\$ – lilKriT Apr 3 at 2:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.