Пример #1
0
    def __init__(self, name=None, clock=None, keyboard=None, mouse=None,
                 location=(0,0), motion=motion((0,0), (0,0)), physics=None,
                 hitbox_passive=hitbox((0, 0), (0, 0)), hitbox_active=hitbox((0, 0), (0, 0)),
                 graphics=None, hitpoints=100):
        '''
        clock, keyboard and mouse are event dispatchers
        location is a tuple of x and y coordinates
        motion, physics are instances of motion and physics
        hitbox_active and hitbox_passive are instances of hitbox
        sprite is an image
        '''

        self.name = name or self.__class__.__name__
        self.allocate_array()
        entity._all[self.arrayid] = self
        self.clock = clock
        self.keyboard = keyboard
        self.mouse = mouse
        self.location = util.arrayify(location)
        self.motion_v = motion.v
        self.motion_a = motion.a
        self.graphics = graphics
        self.physics = physics
        self.hitbox_active = hitbox_active
        self.hitbox_passive = hitbox_passive
        self.tags = set()
        self.hitpoints = hitpoints
        self.controller = None
Пример #2
0
 def __init__(self, sprite, anchor=(0, 0)):
     '''
     sprite is a pygame.surface or other blittable object.
     anchor is a tuple, giving the location of the sprite's
     upper-left corner, relative to the object's location.
     '''
     self.sprite = sprite
     self.anchor = util.arrayify(anchor)
Пример #3
0
 def __init__(self, name, horz_speed):
     super(BaseJumpState, self).__init__(name)
     self.da = util.arrayify((horz_speed, 0.0))
     self.__reset__()