當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。