Beispiel #1
0
    def __init__(self, evManager):
        DirtySprite.__init__(self)

        self._em = evManager

        self.focused = False
        self.dirty = 1
Beispiel #2
0
    def __init__(self, position=(0, 0)):
        DirtySprite.__init__(self)
        self.rect = pygame.Rect(position, (0, 0))

        # determines how the sprite clips
        # clip == 0: sprite does not clip with anything.
        # clip == 1: sprite can be walked past but will also
        #            be hit by projectiles
        # clip == 2: full block
        self.clip = 1

        # image to be drawn each frame
        # change with set_animation and set_image
        self.image = None

        # SheetAnimation instance that controls
        # the current animation
        self.strips = None

        # allows for switching of multiple textures
        self.current_texture = None
        self.animations = {}
        self.images = {}

        self.texture_folder = ""

        # the text shown when hovered by the cursor
        self.examine = []

        # particles need to check for collisions with
        # all other sprites
        self.is_particle = False

        # turn the drawing of this sprite on or off
        self.visible = True
Beispiel #3
0
    def __init__(self, scene):
        DirtySprite.__init__(self)
        self.scene = scene
        self.width = scene.width
        self.height = scene.height
        self.state = 0
        self.states = {
            0: 'offscreen',
            1: 'poise left',
            2: 'stomp left',
            3: 'offscreen',
            4: 'poise right',
            5: 'stomp right',
        }
        self.last_state = 0
        self.just_happened = None


        self.time_between_stomps = 1500 #ms
        # self.time_between_stomps = 1000 #ms
        self.time_of_poise = 1500 #ms
        self.time_of_stomp = 1500 #ms
        self.last_animation = 0 #ms

        # stamp.
        sfx('foot_elephant.ogg')

        self.rect = pygame.Rect([0, 0, self.width//2, self.height])
        self.image = pygame.Surface((self.rect[2], self.rect[3])).convert()
        self.image.fill((255, 0, 0))
        #self.image = gfx('foot.png', convert_alpha=True)
        # gfx('foot_part.png').convert_alpha()
        #self.rect = self.image.get_rect()
        self.rect.x = -1000
        self.rect.y = -1000
Beispiel #4
0
 def __init__(self, fruit, interp_step):
     """ Prepare the fruit's spr: a square diamond 
     with a number in the center.
     interp_step determines where to position the sprite, 
     based on the view's current sprite step. 
     """
     DirtySprite.__init__(self)
     self.fruit = fruit
     
     # make the square
     sq_surf = Surface((cell_size / 1.414, cell_size / 1.414))
     sq_surf.set_colorkey((255, 0, 255))  # magenta = color key
     sq_surf.fill(FRUIT_COLORS[fruit.fruit_type])
     # rotate for a diamond
     dm_surf = rotate(sq_surf, 45)
     blit_rect = Rect(0, 0, cell_size * 1.414, cell_size * 1.414)
     # blit the diamond as the fruit's image
     img = Surface((cell_size, cell_size))
     img.set_colorkey((255, 0, 255))  # magenta = color key
     img.fill((255, 0, 255))
     img.blit(dm_surf, blit_rect)
     
     # add text at the center
     self.font = Font(None, font_size) 
     txtsurf = self.font.render(str(fruit.fruit_num), True, (0, 0, 0))
     textpos = txtsurf.get_rect(center=(cell_size / 2, cell_size / 2))
     img.blit(txtsurf, textpos)
     
     # prepare rect to blit on screen
     self.resync(interp_step)
     
     self.image = img
Beispiel #5
0
    def __init__(
        self,
        dictionary,
        tile,
        pos,
        owner=None,
        known_index=None,
        small_tile=False,
        interact=False,
        rotation=0,
    ):
        if not hasattr(tile, 'get_raw_value'):
            #print('WARNING: Just attempted to pass a PieceType to TileRender!')
            tile = Piece(int(tile))

        DirtySprite.__init__(self)
        tile_surface = dictionary[tile.get_raw_value()].copy()
        tile_surface = transform.rotate(tile_surface, 90 * rotation)
        tile_surface = tile_surface.convert_alpha()
        self.image = tile_surface
        self.pos = pos
        self.rect = pos
        self.owner = owner
        self.known_index = known_index
        self.currently_pressed = False
        sizes = SMALL_TILE_SIZE if small_tile else TILE_SIZE
        self.tile_rect = Rect(self.rect[0], self.rect[1], sizes[0], sizes[1])
        self.can_interact = interact
Beispiel #6
0
 def __init__(self, container, shark_size):
     DirtySprite.__init__(self, container)
     self.rect = pygame.Rect([150, shark_size[1] - 155, shark_size[0], 10])
     # self.rect.x = -1000
     self.image = pygame.transform.scale(
         gfx("shark_laser.png", convert_alpha=True), self.rect.size
     )
Beispiel #7
0
    def __init__(self, img, x, y, col_rect):
        DirtySprite.__init__(self)
        self.image = img
        self.rect = Rect((x,y),self.image.get_rect()[2:])

        self.visible = 1
        self.dirty = 1

        # Directions in which this sprite collide
        self.col_direction = (True, True, True, True)
        
        # Has this sprite sprites attached to him? or the opposite
        # If this is used the guest sprite will be always updated
        # after the host sprite.
        self.guest = False
        self.guests = Group()
        self.host = None

        # Create all the needed rects:
        self.init_rects(self.rect, col_rect)
        
        # Init mask
        self.init_masks()
        
        # if True will print lots of debugging stuff
        self.debugging = False
Beispiel #8
0
 def __init__(self, container, width, height):
     DirtySprite.__init__(self, container)
     from_bottom = 210
     self.rect = pygame.Rect([200, height - from_bottom, width, 30])
     # self.rect.x = -1000
     self.image = pygame.Surface((self.rect[2], self.rect[3])).convert()
     self.image.fill((255, 0, 0))
Beispiel #9
0
    def __init__(self, cat_holder):
        DirtySprite.__init__(self)
        self.cat_holder = cat_holder
        self.image = gfx('cat_unicycle1.png', convert_alpha=True)
        self.rect = self.image.get_rect()
        sfx('cat_jump.ogg')

        self.images = []
        self.flipped_images = []

        self.last_location = [0, 0]
        self.last_direction = True  #right is true
        self.last_rotation = -1
        self.last_frame = None

        self.frame = 1
        self.frame_rate = 750  # time passed in ms before frame changes
        self.frame_time = 0
        self.frame_direction = True  # True = increasing, False = decreasing

        self.num_frames = 4

        for i in range(self.num_frames):
            img = gfx('cat_unicycle%d.png' % (i + 1), convert_alpha=True)
            self.images.append(img)
            self.flipped_images.append(pygame.transform.flip(img, 1, 0))
Beispiel #10
0
 def __init__(self, type, rect):
     DirtySprite.__init__(self)
     self.tie_0 = IMG.subsurface(pygame.Rect(768, 48, 48, 48))  # 全
     self.tie_1 = IMG.subsurface(pygame.Rect(840, 48, 24, 48))  # 右
     self.tie_2 = IMG.subsurface(pygame.Rect(864, 72, 48, 24))  # 下
     self.tie_3 = IMG.subsurface(pygame.Rect(912, 48, 24, 48))  # 左
     self.tie_4 = IMG.subsurface(pygame.Rect(960, 48, 48, 24))  # 上
     self.tie_5 = IMG.subsurface(pygame.Rect(768, 216, 24, 24))  # 小
     self.image = self.tie_0
     self.rect = pygame.Rect(rect[0], rect[1], 48, 48)
     # 根据种类确定墙位置和形状
     if type == 3:  # 完整
         self.image = self.tie_0
         self.rect = pygame.Rect(rect[0], rect[1], 48, 48)
     elif type == 4:  # 上
         self.image = self.tie_4
         self.rect = pygame.Rect(rect[0], rect[1], 48, 24)
     elif type == 5:  # 下
         self.image = self.tie_2
         self.rect = pygame.Rect(rect[0], rect[1] + 24, 48, 24)
     elif type == 6:  # 右
         self.image = self.tie_1
         self.rect = pygame.Rect(rect[0] + 24, rect[1], 24, 48)
     elif type == 7:   # 左
         self.image = self.tie_3
         self.rect = pygame.Rect(rect[0], rect[1], 24, 48)
     self.layer = 1
     self.cunhuo = True
     self.shengming = 2
Beispiel #11
0
 def __init__(self):
     DirtySprite.__init__(self)
     self.image = IMG.subsurface(pygame.Rect(912, 96, 48, 48))
     self.rect = pygame.Rect(288, 576, 48, 48)
     self.layer = 1
     self.cunhuo = True
     self.shengming = 1
Beispiel #12
0
 def __init__(self, location, base_sprite):
     DirtySprite.__init__(self)
     try:
         self.image = sprite_bank.retrieve(base_sprite)
     except KeyError:
         self.image = base_sprite
     self.rect = self.image.get_rect()
     self.rect.left, self.rect.top = location
Beispiel #13
0
 def __init__(self, trackNumber:int, width:int, color:tuple):
     DirtySprite.__init__(self)
     self.track = trackNumber
     self.visible = False
     self.backgroundColor = color
     self.rect = pygame.Rect(0, -1, width, 1)
     self.image = pygame.Surface((self.rect.width, self.rect.height))
     self.image.fill(self.backgroundColor)
Beispiel #14
0
    def __init__(self, pos):
        DirtySprite.__init__(self)
        self.pos = pos

        banana = res.gfx('Banana_happy.png', convert_alpha=True)

        self.img = pygame.transform.scale(banana, (256, 256))
        self.angle = 0
Beispiel #15
0
 def __init__(self, rect):
     DirtySprite.__init__(self)
     self.image = IMG.subsurface(pygame.Rect(960, 336, 48, 48))
     self.rect = pygame.Rect(rect[0], rect[1], 48, 48)
     self.layer = 25
     self.kind = 5
     self.cunhuo = False
     self.time = 200
Beispiel #16
0
 def __init__(self, scene, size, color):
     DirtySprite.__init__(self)
     self.scene = scene
     self.image = Surface(size).convert_alpha()
     self.image.fill(color)
     self.rect = self.image.get_rect()
     self.x, self.y = 0, 0
     self.facing = [0,2]
Beispiel #17
0
    def __init__(self, container, scene, width, height):
        DirtySprite.__init__(self, container)
        self.debug = False
        self.container = container
        self.scene = scene
        self.width, self.height = width, height

        self.state = 0  #
        self.states = {
            0: "offscreen",
            1: "about_to_appear",
            2: "poise",
            3: "aiming",
            4: "fire laser",
            5: "leaving",
        }
        self.last_state = 0
        self.just_happened = None
        self.lazered = False  # was the cat hit?
        self.lazer = None  # type: Optional[Lazer]
        self.laser_height = height - 150  # where should the laser be on the screen?

        # TODO: to make it easier to test the shark
        #        self.time_between_appearances = 1000 #ms
        # self.time_between_appearances = 5000 #ms

        # self.time_of_about_to_appear = 1000#ms
        # self.time_of_poise = 1000 #ms
        # self.time_of_aiming = 500 #ms
        # self.time_of_laser = 200 #ms
        # self.time_of_leaving = 1000 #ms

        self.timings = {
            "time_between_appearances": 5000,
            "time_of_about_to_appear": 1000,
            "time_of_poise": 1000,
            "time_of_aiming": 500,
            "time_of_laser": 200,
            "time_of_leaving": 1000,
        }
        self.last_animation = 0  # ms

        self.applaud = True

        sfx("default_shark.ogg")
        sfx("shark_appear.ogg")
        sfx("shark_gone.ogg")
        sfx("shark_lazer.ogg")
        sfx("applause.ogg")
        sfx("cat_shot.ogg")
        sfx("boo.ogg")

        self.image = gfx("shark.png", convert_alpha=True)
        # gfx('foot_part.png').convert_alpha()
        self.rect = self.image.get_rect()
        self.rect.x = -1000
        self.rect.y = self.height - self.image.get_height()
Beispiel #18
0
    def __init__(self, group, pos, vel, image):
        DirtySprite.__init__(self, group)
        self.image = image
        self.rect = self.image.get_rect()
        self.rect.topleft = pos
        self.velocity = Vector2(vel)

        self.last_pos = [self.rect.x, self.rect.y]
        self.pos = [self.rect.x, self.rect.y]
Beispiel #19
0
    def __init__(self, group, x, y, vx, vy):
        DirtySprite.__init__(self, group)
        self.image = gfx('ring.png', convert_alpha=True)
        self.rect = self.image.get_rect()
        self.rect.x = x
        self.rect.y = y
        self.velocity = pygame.math.Vector2(vx, vy)

        self.last_pos = [x, y]
        self.pos = [x, y]
Beispiel #20
0
 def __init__(self):
     DirtySprite.__init__(self)
     if not self.data['group'] == "text":
         self.image = Surface(self.data['size']).convert_alpha()
         self.image.fill(self.data['color'])
     self.rect = self.image.get_rect()
     self.stopped = True
     self.x, self.y = 0, 0
     self.alpha = None
     self.align()
Beispiel #21
0
    def __init__(self, string, color, location, size):
        DirtySprite.__init__(self)

        self.string = string
        self.color = color
        self.location = location

        self.font = Font(pygame.font.get_default_font(), size)

        self.regen_sprite()
Beispiel #22
0
 def __init__(self, screen, x, y, w, h, viewport):
     DirtySprite.__init__(self)
     self.screen = screen
     self.x = x
     self.y = y
     self.w = w
     self.h = h
     self.rect = pygame.Rect(x, y, w, h)
     self.viewport = viewport
     self.dirty = 1
Beispiel #23
0
 def __init__(self, score_holder):
     """
     score_holder has a 'score' attrib.
     """
     DirtySprite.__init__(self)
     self.score_holder = score_holder
     self.myfont = pygame.font.SysFont("monospace", 30, bold=True)
     self.image = self.myfont.render(str(self.score_holder.score), True,
                                     [0, 0, 0])
     self.update_rect()
     self.last_score = self.score_holder.score
    def __init__(self, x, y, image, viewport):
        DirtySprite.__init__(self)

        self.viewport = viewport

        self.x = x
        self.y = y

        self.image = image
        self.rect = self.image.get_rect().move(x * config.image_size[0],
                                               y * config.image_size[1])
Beispiel #25
0
    def __init__(self, group, x, y, vx, vy):
        DirtySprite.__init__(self, group)
        self.image = gfx("fish_" + random.choice(Fish.colors) + ".png", convert_alpha=True)
        self.rect = self.image.get_rect()
        size = self.rect.size
        self.rect.x = x
        self.rect.y = y
        self.velocity = pygame.math.Vector2(vx, vy)

        self.last_pos = [x, y]
        self.pos = [x,y]
Beispiel #26
0
 def __init__(self, rect):
     DirtySprite.__init__(self)
     self.he_0 = IMG.subsurface(pygame.Rect(768, 96, 48, 48))
     self.he_1 = IMG.subsurface(pygame.Rect(768, 144, 48, 48))
     self.he_2 = IMG.subsurface(pygame.Rect(816, 144, 48, 48))
     # 用于实现动态效果
     self.he_xiaoguo = [self.he_0, self.he_1, self.he_2]
     self.image = self.he_0
     self.time = (int(random.random() * 3) + 2)
     self.rect = pygame.Rect(rect[0], rect[1], 48, 48)
     self.layer = 1
     self.cunhuo = True
Beispiel #27
0
 def __init__(self, parentSurface:pygame.Surface, rect:pygame.Rect, skin:Skin):
     DirtySprite.__init__(self)
     self.parentSurface = parentSurface
     self.image = pygame.Surface((rect.width, rect.height))
     self.image.fill(skin.guiColor("Popup Background"))
     self.rect = rect
     self.contentRect = Positioning.innerRect(self.image.get_rect(), Padding.POPUP_WINDOW_FRAME)
     toolbarHeight = (Padding.POPUP_WINDOW_FRAME * 2) + Sizing.POPUP_WINDOW_FRAME_BUTTON
     self.contentRect = pygame.Rect(Padding.POPUP_WINDOW_FRAME,
                                    toolbarHeight,
                                    rect.width - (Padding.POPUP_WINDOW_FRAME * 2),
                                    rect.height - toolbarHeight - Padding.POPUP_WINDOW_FRAME)
     self.skin = skin
     self.visible = False
Beispiel #28
0
    def __init__(self):
        DirtySprite.__init__(self)

        self.last_location = [0, 0]
        self.last_direction = True  # right is true
        self.last_rotation = -1
        self.last_frame = None

        self.frame = 1
        self.frame_rate = 750  # time passed in ms before frame changes
        self.frame_time = 0
        self.frame_direction = True  # True = increasing, False = decreasing

        self.num_frames = 4
Beispiel #29
0
    def __init__(self, points):
        """
        score_holder has a 'score' attrib.
        """
        DirtySprite.__init__(self)
        color = [255, 0, 0]

        # draw dead zones
        surf = pygame.display.get_surface()
        rect = pygame.draw.polygon(surf, color, points)
        self.image = surf.subsurface(rect.clip(surf.get_rect())).copy()
        self.rect = self.image.get_rect()
        self.rect.x = rect.x
        self.rect.y = rect.y
Beispiel #30
0
 def __init__(self, image=None, shape=None, factor=1.0):
     DirtySprite.__init__(self)
     self.original_image = image
     self.shape = shape
     self._old_angle = None
     self.image = None
     self.rect = None
     if shape and image:
         bounding_box = shape.cache_bb()
         size = (
             int((bounding_box.right - bounding_box.left) * factor),
             int((bounding_box.top - bounding_box.bottom) * factor),
         )
         self.original_image = smoothscale(image, size)
Beispiel #31
0
 def __init__(self, yuan):
     DirtySprite.__init__(self)
     self.boom_0 = boom_img_1.subsurface(pygame.Rect(768, 384, 48, 48))
     self.boom_1 = boom_img_1.subsurface(pygame.Rect(816, 384, 48, 48))
     self.boom_2 = boom_img_1.subsurface(pygame.Rect(864, 384, 48, 48))
     self.boom_3 = boom_img_2.subsurface(pygame.Rect(456, 192, 48, 48))
     self.boom_4 = boom_img_2.subsurface(pygame.Rect(504, 192, 48, 48))
     self.image = self.boom_0
     self.rect = pygame.Rect(0, 0, 48, 48)
     self.rect.centerx, self.rect.centery = yuan.rect.centerx, yuan.rect.centery
     self.layer = 60
     # 实现动态效果
     self.cunhuo = True
     self.time = 0
Beispiel #32
0
    def __init__(self, score_holder):
        """
        score_holder has a 'score' attrib.
        """
        DirtySprite.__init__(self)
        self.score_holder = score_holder
        self.myfont = pygame.font.SysFont("monospace", 20)
        self.image = self.myfont.render(
            "score : " + str(self.score_holder.score), True, [255, 255, 255]
        )
        self.rect = self.image.get_rect()
        self.rect.x = 100
        self.rect.y = 100

        self.last_score = self.score_holder.score
Beispiel #33
0
    def __init__(
        self,
        location,  # Location enum, defines where the sprite must disappear to
        position,  # x-y coordinates of self.rect.topleft
        screen  # pygame.Rect object that indicates the entire screen
    ):
        self.logger = logging.getLogger(self.__class__.__name__)
        DirtySprite.__init__(self)

        self.location = location
        self.base_position = position
        self.target_position = position
        self.screen = screen

        self.set_position(position)
Beispiel #34
0
 def __init__(self):
     DirtySprite.__init__(self)
     self.level = 0
     self.speed = 0
     self.shengming = 0
     self.cunhuo = False
     self.can_move = False
     self.tabing = False
     self.img = IMG
     self.rect = pygame.Rect(10, 10, 48, 48)
     self._layer = 50
     self.direction_x, self.direction_y = 0, 1
     self.zidan = None
     self.tianzhuang = 10
     self.zidanlevel = 0
     self.zidanspeed = 0
Beispiel #35
0
    def __init__(self, x, y, w, h, viewport):
        DirtySprite.__init__(self)

        self.rect = pygame.Rect(x, y, w, h)

        self.hud_state = {}
        self.children = [MainHudScreen(self, x, y, w, h, viewport)]

        self.surf = pygame.Surface((w, h), flags=pygame.SRCALPHA)
        self.surf.fill(pygame.Color("#000000"))

        self.register_state("alerts", [])

        self.updates = []

        self.dirty = 1
Beispiel #36
0
    def __init__(self, container, scene, width, height):
        DirtySprite.__init__(self, container)
        self.container = container
        self.scene = scene
        self.width, self.height = width, height

        self.state = 0  #
        self.states = {
            0: 'offscreen',
            1: 'about_to_appear',
            2: 'poise',
            3: 'aiming',
            4: 'fire laser',
            5: 'leaving',
        }
        self.last_state = 0
        self.just_happened = None
        self.lazered = False  # was the cat hit?
        self.lazer = None
        self.laser_height = height - 150  #where should the laser be on the screen?

        #TODO: to make it easier to test the shark
        #        self.time_between_appearances = 1000 #ms
        self.time_between_appearances = 5000  #ms

        self.time_of_about_to_appear = 1000  #ms
        self.time_of_poise = 1000  #ms
        self.time_of_aiming = 500  #ms
        self.time_of_laser = 200  #ms
        self.time_of_leaving = 1000  #ms
        self.last_animation = 0  #ms

        self.applaud = True

        sfx('default_shark.ogg')
        sfx('shark_appear.ogg')
        sfx('shark_gone.ogg')
        sfx('shark_lazer.ogg')
        sfx('applause.ogg')
        sfx('cat_shot.ogg')
        sfx("boo.ogg")

        self.image = gfx('shark.png', convert_alpha=True)
        # gfx('foot_part.png').convert_alpha()
        self.rect = self.image.get_rect()
        self.rect.x = -1000
        self.rect.y = (self.height - self.image.get_height())
Beispiel #37
0
    def __init__(self, scene):
        DirtySprite.__init__(self)

        self.scene = scene

        self.animation = ElephantAnimation()

        # stamp.
        sfx("foot_elephant.ogg")

        self.rect = pygame.Rect(
            [0, 0, self.scene.width // 2, self.scene.height])
        self.image = Surface((self.rect[2], self.rect[3])).convert()
        self.image.fill((255, 0, 0))

        self.rect.x = -1000
        self.rect.y = -1000
Beispiel #38
0
    def __init__(self, x, y, w, h, viewport):
        DirtySprite.__init__(self)

        self.viewport = viewport
        self.enterprise = None
        self.dispatcher = None

        self.rect = pygame.Rect(x, y, w, h)

        self.font = pygame.font.Font("assets/bitwise/bitwise.ttf", 25)
        self.small_font = pygame.font.Font("assets/bitwise/bitwise.ttf", 15)

        self.hovered_unit = None
        self.hovered_stock_pile = None

        self.dirty = 2

        self.alerts = []
Beispiel #39
0
	def __init__(self, block_id, screen, position, img_filename, state):
		"""STUFF FOR EXPLENATION
		"""
		DirtySprite.__init__(self)
		self.block_id = block_id
		self.screen = screen
		self.position = position
		self.image = pygame.image.load(img_filename)
		#If you want to go back to just surfaces, comment out below code
		#self.image = pygame.Surface(BLOCK_SIZE)
		#pointlist = [(0,0), (0,BLOCK_SIZE[1]), (BLOCK_SIZE), (BLOCK_SIZE[0],0)]
		#pygame.draw.polygon(self.image, RED, pointlist)
		
		self.x=(self.position[0]*self.image.get_width())
		self.y=(self.position[1]*self.image.get_height())
		#self.rect = self.image.get_rect(center = centerpos)
		self.rect = pygame.Rect(self.x, self.y, self.image.get_width(), self.image.get_height())
		self.state = state
Beispiel #40
0
    def __init__(self,
                 settings,
                 color,
                 x,
                 y,
                 img=None,
                 blocked=False,
                 block_sight=None):
        """Initialize the Tile"""
        #TODO image.fill nimmt self.color nicht an / updated gar nicht
        #super(Tile, self).__init__()
        DirtySprite.__init__(self)
        self.settings = settings
        self.screen = settings.screen
        self.color = color
        self.tilesize = settings.tilesize
        self.image = pg.Surface((self.tilesize, self.tilesize))
        self.image.fill(self.color)
        self.rect = self.image.get_rect()
        self.x = x
        self.y = y
        # self.screen_width = settings.screen_width
        # self.screen_height = settings.screen_height

        # all tiles start unexplored
        self.explored = False

        #??
        self.rect.x = x * self.tilesize
        self.rect.y = y * self.tilesize

        #DirtySprite kacke
        self.dirty = 1

        # TODO useless?
        #if img != None:
        #    self.image = img

        self.blocked = blocked
        # by default, if a tile is blocked, it also blocks sight
        if block_sight is None: block_sight = blocked
        self.block_sight = block_sight
        """TEST Explored makes Shadow rectangle"""
Beispiel #41
0
 def __init__(self):
     DirtySprite.__init__(self)
     self._x, self._y, self._width, self._height = 0, 0, 0, 0
     self.rect = Rect(self._x, self._y, self._width, self._height)
     self.image = None
     self.pos = self._x, self._y
Beispiel #42
0
 def __init__(self, img, x, y, **kwargs):
     self.image = img
     DirtySprite.__init__(self)
     self.rect = Rect((x,y),self.image.get_rect()[2:])
     self.col_rect = self.rect
Beispiel #43
0
	def __init__(self, screen): 
		DirtySprite.__init__(self)
		self.screen = screen
		self.image = pg.Surface((0, 0))
		self.rect = Rect(0, 0, 0, 0)
Beispiel #44
0
 def __init__(self, img, x, y):
     DirtySprite.__init__(self)
     self.image = img
     self.rect = Rect(x, y, *img.get_rect()[2:])
     self.col_rect = self.rect
Beispiel #45
0
 def __init__(self, position:Position, rect:pygame.Rect, speedInPxPerSec:float):
     DirtySprite.__init__(self)
     self.position = position
     self.rect = rect
     self.speedInPxPerSec = float(speedInPxPerSec)
     self.movePixels = 0
Beispiel #46
0
 def __init__(self, em):
     DirtySprite.__init__(self)
     self._em = em
     self.dirty = 1