def set_tint(self, tint): """set_tint( tint) tint: a tuple or list of 3 or 4 elements- (red, green, blue, [alpha]) the alpha element will be ignored. Use set_alpha or to set that.""" color = (tint[0]/255.0, tint[1]/255.0, tint[2]/255.0, self.get_alpha()) OpioidSprite.set_color( self, color)
def set_tint(self, tint): """set_tint( tint) tint: a tuple or list of 3 or 4 elements- (red, green, blue, [alpha]) the alpha element will be ignored. Use set_alpha or to set that.""" color = (tint[0] / 255.0, tint[1] / 255.0, tint[2] / 255.0, self.get_alpha()) OpioidSprite.set_color(self, color)
def set_image(self, image): try: OpioidSprite.set_image(self, image) except: image = destandardize_path(image) OpioidSprite.set_image(self, image) if isinstance(image, basestring): self._image_file = image
def set_image(self, image): try: OpioidSprite.set_image( self, image) except: image = destandardize_path(image) OpioidSprite.set_image( self, image) if isinstance(image, basestring): self._image_file = image
def __init__(self, img=None, gname='', register=None): #_DEBUG = False # #if _DEBUG: print "Sprite.__init__ 0" pug.BaseObject.__init__(self, gname=gname) #if _DEBUG: print "Sprite.__init__ 1" OpioidSprite._preinit(self, img) #if _DEBUG: print "Sprite.__init__ 2" self.collision_groups = set([]) #if _DEBUG: print "Sprite.__init__ 3" self.on_create() #if _DEBUG: print "Sprite.__init__ 4" if register is None: register = self.auto_scene_register if register: self.scene_register() self.initialized = True if self._init_image: self._image_file = self._init_image
def set_layer(self, layer): if layer not in PigDirector.scene.layers: PigDirector.scene.add_layer(layer) OpioidSprite.set_layer(self, layer) if _DEBUG: print "Sprite.set_layer calling scene.update_node" PigDirector.scene.update_node(self) # register self with scene
def get_tint(self): "get_tint()->the (red, green, blue) color value of the sprite" color = OpioidSprite.get_color(self) return (int(round(color[0] * 255.0)), int(round(color[1] * 255)), int(round(color[2] * 255)))
def delete(self): if self._mouse_registered: self.mouse_unregister() PigDirector.scene.update_node(self, "Delete") OpioidSprite.delete(self)
def leave_group(self, group): self.collision_groups.discard(group) OpioidSprite.leave_group(self, group)
def leave_collision_groups(self): "leave_collision_groups(): leave all collision groups" for group in self.collision_groups: OpioidSprite.leave_group(self, group) self.collision_groups = set([])
def get_tint(self): "get_tint()->the (red, green, blue) color value of the sprite" color = OpioidSprite.get_color( self) return (int(round(color[0]*255.0)), int(round(color[1]*255)), int(round(color[2]*255)))
def delete(self): if self._mouse_registered : self.mouse_unregister() PigDirector.scene.update_node(self, "Delete") OpioidSprite.delete(self)
def leave_collision_groups(self): "leave_collision_groups(): leave all collision groups" for group in self.collision_groups: OpioidSprite.leave_group(self, group) self.collision_groups=set([])