bitcraft / pyscroll

make scrolling games with animated maps in pygame
GNU General Public License v3.0
172 stars 28 forks source link

DirtySprite in Pyscrollgroup is rendered but blendmode is being ignored #14

Closed ri0t closed 8 years ago

ri0t commented 8 years ago

Ahoi again, this time i'm having a little trouble adding fog of exploration. It might be me doing things wrong again, but to illustrate, this is what i'm trying:

self.fog = pygame.sprite.DirtySprite() self.fog.blendmode = pygame.BLEND_RGBA_MIN self.fog.rect = pygame.Rect([0,0,self.render_size[0], self.render_size[1]]) self.fog.image = pygame.Surface([self.map_data.map_size[0]_self.map_data.tile_size[0], self.map_data.map_size[1]_self.map_data.tile_size[1]]).convert_alpha() self.fog.image.fill((0,0,0, 255)) self.mapgroup.add(self.fog, layer=15)

I can now fill nice faded circles around the actor position and get an added non-transparent surface with the fog "seemingly lifted correctly". Seems to me like the blendmode i set in the sprite is ignored.

bitcraft commented 8 years ago

Hello again, friend. Yes, I am sure you are right. I will look into it. :smile:

bitcraft commented 8 years ago

I was not reading the sprite blendmode attribute, and I've made a few changes to support it. It seems to be working on my tests. I've pushed a new update, please pull the changes and try again.

ri0t commented 8 years ago

Omg, i updated to the new version in my virtualenv and now somehow inmidst of (my!) code it throws an attribute-error that pygame.gfxdraw were unknown, suddenly :(( I don't think this is directly related to pyscroll. Any Idea?

bitcraft commented 8 years ago

Thats odd...it should only attempt to use that if you are using shape drawing.

ri0t commented 8 years ago

Aah, you removed a direct "import python.gfxdraw", which i never did, but is necessary to set it up, once.. on to test the new blendmode =)

ri0t commented 8 years ago

Yup, thaaaat is sweeet! I have the nicest fog'o'exploration i could imagine. Now i just need to teach it how to obey walls.

bitcraft commented 8 years ago

I'd love to see a video of it sometime. Glad it worked for you.