Search Results

Search found 2 results on 1 pages for 'fristi'.

Page 1/1 | 1 

  • Spritegroups and colorkeys

    - by Fristi
    I have a problem using spritegroups in pygame. In my situation I have 2 spritegroups, one for humans, one for "infected". A human is represented by a blue circle: image = pygame.Surface((32,32)) image.fill((255,255,255)) pygame.draw.circle(image,(0,0,255),(16,16),16) image = image.convert() image.set_colorkey((255,255,255)) An infected by a red one (same code, different color). I update my spritegroups as follows: self.humans.clear(self.screen, self.bg) self.humans.update(time_passed) self.humans.draw(self.screen) self.infected.clear(self.screen, self.bg) self.infected.update(time_passed) self.infected.draw(self.screen) Self.bg is defined: self.bg = pygame.Surface((SCREEN_WIDTH, SCREEN_HEIGHT)) self.bg.fill((255,255,255)) self.bg.convert() This all works, except that when a red circle overlaps with a blue one, you can see the white corners of the bounding box around the actual circle. Within a spritegroup it works, using the set_colorkey function. This does not happen with overlapping blue circles or overlapping red circles. I tried adding a colorkey to self.bg but that did not work. Same for adding a colorkey to self.screen.

    Read the article

  • [AS3] BitmapData cut-off

    - by Fristi
    Hello, I am writing a MovieClip rasterizer which rasterizes all the frames in the specified movieclip. Here's the code for rasterizing: for ( var i:int = start; i <= end; i++ ) { //goto the next frame clip.gotoAndStop( i ); //get the bounds bounds = clip.getBounds(clip); //create a new bitmapdata container bitmapData = new BitmapData( transformer.width == -1 ? bounds.width : transformer.width, transformer.height == -1 ? bounds.height : transformer.height, transformer.transparent, transformer.color ); //rotate the clip if (clip.rotation != 0) transformer.rotate( clip.rotation * (Math.PI / 180) ); //scale the clip if (clip.scaleX != 1 || clip.scaleY != 1) transformer.scale( clip.scaleX, clip.scaleY ); //translate the movieclip to its zero point if (transformer.matrix.tx == 0 && transformer.matrix.ty == 0) transformer.translateToZero( bounds ); //draw the bitmap data with the transformers bitmapData.draw( this._source, transformer.matrix, transformer.colorTransform, transformer.blendMode, transformer.clipRect, //new Rectangle(0, 0, bounds.width, bounds.height), transformer.smoothing ); //push the data on the array frames.push( bitmapData ); } Now the result is different - http://i42.tinypic.com/lfv52.jpg - (note the head and left shoe). Anyone knows what the problem is? I've seen people adding 'extra' pixels to their boundary box at the BitmapData constructor, but thats nasty imo.

    Read the article

1