White pixels are transparent

Understanding the language, error messages, etc.

White pixels are transparent

Postby noah » Wed Aug 10, 2016 4:20 pm

Hi, so I made a little sprite that moves around a map, but my floor tiles have dot textures on, and they appear in the face of my character, even though I filled the face in white before converting to hexadecimal. Is there any way to change this? Or should I just remove the dots from the floor?

Thanks in advance, -noah
User avatar
noah
 
Posts: 25
Joined: Mon Jul 25, 2016 8:32 am
Location: Spiffin' Britain

Re: White pixels are transparent

Postby Sorunome » Wed Aug 10, 2016 5:09 pm

When using gb.drawBitmap with color set to BLACK, white pixels are indeed rendered as transparent. The work-around is to draw e.g. a white rectangle on where you want to draw your sprite first.
User avatar
Sorunome
 
Posts: 629
Joined: Sun Mar 01, 2015 1:58 pm

Re: White pixels are transparent

Postby noah » Wed Aug 10, 2016 8:05 pm

so I did
Code: Select all
gb.display.setColor(white, white);
gb.display.fillRect(playerX, playerY, 10, 10);

(10 is the width/height of my sprite) before drawing the bitmap, and now they have completely disappeared!
Why is this?

thanks, noah
User avatar
noah
 
Posts: 25
Joined: Mon Jul 25, 2016 8:32 am
Location: Spiffin' Britain

Re: White pixels are transparent

Postby noah » Wed Aug 10, 2016 8:07 pm

Hi,
I fixed the sprite disappearing by setting color back to black before drawing the bitmap but now the walls and ground show through them again. Not quite sure what to do...
User avatar
noah
 
Posts: 25
Joined: Mon Jul 25, 2016 8:32 am
Location: Spiffin' Britain

Re: White pixels are transparent

Postby Duhjoker » Thu Aug 11, 2016 2:44 am

the guide found here........

viewtopic.php?f=8&t=3440#p11603

should answer your questions and more.
User avatar
Duhjoker
 
Posts: 446
Joined: Sat Jul 02, 2016 4:57 am
Location: Where Palm trees grow


Return to Programming Questions

Who is online

Users browsing this forum: No registered users and 14 guests

cron