Пример #1
0
    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)
Пример #2
0
    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)
Пример #3
0
 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
Пример #4
0
 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
Пример #5
0
 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
Пример #6
0
 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
Пример #7
0
 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
Пример #8
0
 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)))
Пример #9
0
 def delete(self):
     if self._mouse_registered:
         self.mouse_unregister()
     PigDirector.scene.update_node(self, "Delete")
     OpioidSprite.delete(self)
Пример #10
0
 def leave_group(self, group):
     self.collision_groups.discard(group)
     OpioidSprite.leave_group(self, group)
Пример #11
0
 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([])
Пример #12
0
 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    
Пример #13
0
 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)))
Пример #14
0
 def delete(self):
     if self._mouse_registered :
         self.mouse_unregister()
     PigDirector.scene.update_node(self, "Delete") 
     OpioidSprite.delete(self)
Пример #15
0
 def leave_group(self, group):
     self.collision_groups.discard(group)
     OpioidSprite.leave_group(self, group)
Пример #16
0
 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([])