当前位置: 首页>>代码示例>>Python>>正文


Python Group.__init__方法代码示例

本文整理汇总了Python中pygame.sprite.Group.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python Group.__init__方法的具体用法?Python Group.__init__怎么用?Python Group.__init__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pygame.sprite.Group的用法示例。


在下文中一共展示了Group.__init__方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: from pygame.sprite import Group [as 别名]
# 或者: from pygame.sprite.Group import __init__ [as 别名]
    def __init__(self, bounds):
        Group.__init__(self)

        self.bounds = bounds

        self.spawn_rate = COIN_SPAWN_RATE * 1000
        self.spawn_timer = 0
开发者ID:sgoodspeed,项目名称:samKeenanGame,代码行数:9,代码来源:coin.py

示例2: __init__

# 需要导入模块: from pygame.sprite import Group [as 别名]
# 或者: from pygame.sprite.Group import __init__ [as 别名]
 def  __init__(self, moving_sprite,
               speedx = 0,
               maxspeedx = -1,
               speedy = 0,
               maxspeedy = -1,
               posx = 0,
               posy = 0,
               thrust_strength = 0,
               accelx = 0,
               accely = 0,
               gravity = 1000,
               decrease_speed_ratio = 2.0):
     Group.__init__(self)
     self.moving_sprite = moving_sprite
     self.speedx = speedx
     self.speedy = speedy
     self.maxspeedx = maxspeedx
     self.maxspeedy = maxspeedy
     self.posx = posx
     self.posy = posy
     self.thrust_strength = thrust_strength
     self.accelx = accelx
     self.accely = accely
     self.gravity = gravity
     self.decrease_speed_ratio = decrease_speed_ratio
     self.bumping_walls = []
开发者ID:benoxoft,项目名称:Bomberbirds,代码行数:28,代码来源:movement.py

示例3: __init__

# 需要导入模块: from pygame.sprite import Group [as 别名]
# 或者: from pygame.sprite.Group import __init__ [as 别名]
 def __init__(self, map, imageCache, rectPixelView, imWidth, imHeight):
     Group.__init__(self)
     self._changeListeners = []
     self.map = map
     self.worldRect = Rect(0, 0, self.map.width * imWidth, self.map.height * imHeight)
     self.imageCache = imageCache
     self.imageSize = (imWidth, imHeight)
     self.offsetX = 0
     self.offsetY = 0
     self.setView(rectPixelView)
开发者ID:nowl,项目名称:games,代码行数:12,代码来源:map.py

示例4: __init__

# 需要导入模块: from pygame.sprite import Group [as 别名]
# 或者: from pygame.sprite.Group import __init__ [as 别名]
 def __init__(self, map, imageCache, rectPixelView, imWidth, imHeight):
     Group.__init__(self)
     self._changeListeners = []
     self.upperLeft = [0, 0]
     self.numTiles = (int(rectPixelView.width / imWidth), int(rectPixelView.height / imHeight))
     self.map = map
     self.imageCache = imageCache
     self.imageSize = (imWidth, imHeight)
     self.offsetX = 0
     self.offsetY = 0
     self.setView(rectPixelView)
开发者ID:nowl,项目名称:deforium,代码行数:13,代码来源:map.py

示例5: __init__

# 需要导入模块: from pygame.sprite import Group [as 别名]
# 或者: from pygame.sprite.Group import __init__ [as 别名]
 def __init__(self):
     Group.__init__(self)
     BaseModel.__init__(self)
     # load image
     _money_image = pygame.image.load(
         get_file_path('img/item/money.png')).convert_alpha()
     _subsurface_data = [(25, 24), (25, 24), (33, 30), (32, 31)]
     _y = 0
     self.money_images = []
     for _sub_data in _subsurface_data:
         _tmp_list = [_money_image.subsurface(
             (i*_sub_data[0], _y), _sub_data) for i in range(4)]
         _y += _sub_data[1]
         self.money_images.append(_tmp_list)
     _item_rare_image = pygame.image.load(
         get_file_path('img/item/rare_42x44.png')).convert_alpha()
     self.item_rare_images = [_item_rare_image.subsurface(
         (i*ITEM_RARE_SIZE[0], 0), ITEM_RARE_SIZE) for i in range(6)]
     # load icons, but now only load one image
     self.item_icons = pygame.image.load(
         get_file_path('img/item/04000019.png')).convert_alpha()
开发者ID:pineapplebin,项目名称:ClickHero,代码行数:23,代码来源:item_group.py

示例6: __init__

# 需要导入模块: from pygame.sprite import Group [as 别名]
# 或者: from pygame.sprite.Group import __init__ [as 别名]
 def __init__(self, target, sprite_filename, formation, target_position):
 
     Group.__init__(self)
     
     self.target = target
     self.sprite_filename = sprite_filename
     self.target_position = target_position
     
     #this image is passed to each Cell object
     cell_image = pygame.image.load(sprite_filename).convert_alpha()
     
     #convert formation list into table of cell sprites
     #offsets are the difference between current cell and target cell
     #since first cell is (0, 0) these start as negative of the target
     row_offset = -target_position[0]
     cells = []
     for row in formation:
         col_offset = -target_position[1]
         cells_row = []
         for col in row:
             #0 means the cell is empty
             if col == 0:
                 cells_row.append(None)
             #1 means a cell sprite should be added here
             elif col == 1:
                 new_cell = Cell(row_offset, col_offset, cell_image, target)
                 Group.add(self, new_cell)
                 cells_row.append(new_cell)
             #anything else means wtf are you doing
             else: raise
             col_offset += 1
         cells.append(cells_row)
         row_offset += 1
         
     self.cells = cells
     
     self.delay = 0
开发者ID:rubiximus,项目名称:yars-revenge,代码行数:39,代码来源:enemy_shield.py

示例7: __init__

# 需要导入模块: from pygame.sprite import Group [as 别名]
# 或者: from pygame.sprite.Group import __init__ [as 别名]
    def __init__(self, bullets):
        """Initializes the group and makes a wave of enemies
        window_size is a tuple with the window dimensions (width, height)
        rows, cols are the height and width resp. of enemies in the waves
        gap is the number of pixels between each sprite
        speed is the number of pixels moved at once
        move_delay is the number of frames waited between movements
        shoot_delay is the number of frames between enemy shots
        bullets is a Group that will hold the enemies' bullets
        sprite_filename is the sprite file for the ships
        """

        Group.__init__(self)
        self.window_size = window_size
        self.rows = wave_rows
        self.cols = wave_cols
        self.gap = wave_gap
        self.speed = enemy_speed
        self.move_delay = enemy_delay
        self.shoot_delay = enemy_shoot_delay
        self.bullets = bullets
        self.sprite_filename = enemy_filename

        self.build_wave()
开发者ID:rubiximus,项目名称:invader-shootan,代码行数:26,代码来源:enemy_group.py

示例8: __init__

# 需要导入模块: from pygame.sprite import Group [as 别名]
# 或者: from pygame.sprite.Group import __init__ [as 别名]
	def __init__(self, *sprites):
		Group.__init__(self, *sprites)
开发者ID:dgalaktionov,项目名称:Aleph,代码行数:4,代码来源:EntityGroup.py

示例9: __init__

# 需要导入模块: from pygame.sprite import Group [as 别名]
# 或者: from pygame.sprite.Group import __init__ [as 别名]
 def __init__(self, count):
     Group.__init__(self)
     self.count = count
开发者ID:jlevey3,项目名称:CS112-Spring2012,代码行数:5,代码来源:main.py

示例10: __init__

# 需要导入模块: from pygame.sprite import Group [as 别名]
# 或者: from pygame.sprite.Group import __init__ [as 别名]
 def __init__(self, count):
     Group.__init__(self)
     self.max = count
开发者ID:HampshireCS,项目名称:cs143-Spring2012,代码行数:5,代码来源:shiphunt.py

示例11: __init__

# 需要导入模块: from pygame.sprite import Group [as 别名]
# 或者: from pygame.sprite.Group import __init__ [as 别名]
 def __init__(self):
     Group.__init__(self)
开发者ID:mitkrieg,项目名称:CS112-Spring2012,代码行数:4,代码来源:enemyshoot.py

示例12: __init__

# 需要导入模块: from pygame.sprite import Group [as 别名]
# 或者: from pygame.sprite.Group import __init__ [as 别名]
 def __init__(self):
     """
     Constructor.
     """
     Group.__init__(self)
开发者ID:coleary9,项目名称:RockBrawl,代码行数:7,代码来源:dynamicGroup.py

示例13: __init__

# 需要导入模块: from pygame.sprite import Group [as 别名]
# 或者: from pygame.sprite.Group import __init__ [as 别名]
    def __init__(self, bounds):
        Group.__init__(self)

        self.bounds = bounds
        self.spawn_timer = 0
开发者ID:AKilgore,项目名称:CS112-Spring2012,代码行数:7,代码来源:coin.py

示例14: __init__

# 需要导入模块: from pygame.sprite import Group [as 别名]
# 或者: from pygame.sprite.Group import __init__ [as 别名]
    def __init__(self):
        Group.__init__(self)

        dispatcher.connect(self.add_sprite, signal=signals.NEW_OBJECT, sender=Player)
开发者ID:HampshireCS,项目名称:CS112-Spring2012,代码行数:6,代码来源:player.py

示例15: __init__

# 需要导入模块: from pygame.sprite import Group [as 别名]
# 或者: from pygame.sprite.Group import __init__ [as 别名]
 def __init__(self, *sprites):
     self._spritelist = []
     Group.__init__(self, *sprites)
开发者ID:barbieri,项目名称:barbieri-playground,代码行数:5,代码来源:smart_render.py


注:本文中的pygame.sprite.Group.__init__方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。