Sign in to follow this  
monp

python cutting out background

Recommended Posts

I have a Tileset I want to try to draw onto the screen, its background is a wierd darkish blue color. How would I go about making only the image show up. Also as a second question how would i draw onto multiply layers so i don't delete the ground in the background.

Share this post


Link to post
Share on other sites
I am just testing with a fake built inside building background through pygame.image.load and just blitting it to the screen. I dont know how to cut up the other file to actually use the tileset and draw over the background without deleting the part it lies over.

Share this post


Link to post
Share on other sites
Ok lets say example.png has different parts of houses and others things on it, like there are 4 parts to the house in a row in the picture together it makes one house, 1234 how would i take certain parts of the picture at a time, and redraw them onto the pygame screen as
12
34
to make the house.

Share this post


Link to post
Share on other sites
like this (pseudocode, not python)

you define four rectangles specifying the parts of the house

x, y = desired position of upper-left corner of house on screen
blit(screen, (x,y), rect_1)
blit(screen, (x + rect_1.width, y), rect_2)
blit(screen, (x, y + rect_1.height), rect_3)
blit(screen, (x + rect_1.width, y + rect_1.height), rect_4)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this