python cutting out background
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.
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.
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.
12
34
to make the house.
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)
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)
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement