當前位置: 首頁>>代碼示例>>Python>>正文


Python Application.__init__方法代碼示例

本文整理匯總了Python中app.Application.__init__方法的典型用法代碼示例。如果您正苦於以下問題:Python Application.__init__方法的具體用法?Python Application.__init__怎麽用?Python Application.__init__使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在app.Application的用法示例。


在下文中一共展示了Application.__init__方法的12個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: __init__

# 需要導入模塊: from app import Application [as 別名]
# 或者: from app.Application import __init__ [as 別名]
    def __init__(self):
        pygame.init()
        #self.screen_size = pygame.display.list_modes()[0]

        Application.__init__(self)
        #pygame.display.toggle_fullscreen()    


        self.ships = ShipGroup(self.max_ships)
        self.xplos = ExplosionGroup()

        self.screen_bounds = bounds = self.screen.get_rect()

        dc_height = 40
        self.dc_font = pygame.font.Font(None, 30)
        self.dc_bounds = Rect(0, bounds.height - dc_height, bounds.width, dc_height)

        self.game_bounds = Rect(0, 0, bounds.width, bounds.height - dc_height)

        spawn_area = self.game_bounds.inflate(-self.game_bounds.width/4, -self.game_bounds.height/4)
        self.spawners = [
            TieSpawner(1000, self.ships, self.game_bounds, spawn_area),
            YWingSpawner(2000, self.ships, self.game_bounds)
        ]
        self.detonator = Detonator(self.game_bounds, self.xplos)

        for spawner in self.spawners:
            spawner.spawn()


        Ship.death_count = DeathCount()
        self.current_weapon = MiniExplosionsWeapon(self)
開發者ID:HampshireCS,項目名稱:cs143-Spring2012,代碼行數:34,代碼來源:shiphunt.py

示例2: __init__

# 需要導入模塊: from app import Application [as 別名]
# 或者: from app.Application import __init__ [as 別名]
    def __init__(self):
        Application.__init__(self)

        self.bounds = self.screen.get_rect()
        self.ships = Group()

        self.spawners = [ TieSpawner(2000, self.ships, self.bounds) ]
開發者ID:HampshireCS,項目名稱:cs143-Spring2012,代碼行數:9,代碼來源:main3.py

示例3: __init__

# 需要導入模塊: from app import Application [as 別名]
# 或者: from app.Application import __init__ [as 別名]
    def __init__(self):
        Application.__init__(self)

        self.bounds = self.screen.get_rect()
        self.ships = ShipGroup(self.max_ships)

        self.spawners = [ TieSpawner(2000, self.ships, self.bounds),
                          YWingSpawner(2000, self.ships, self.bounds) ]
開發者ID:altarim992,項目名稱:CS112-Spring2012,代碼行數:10,代碼來源:main.py

示例4: __init__

# 需要導入模塊: from app import Application [as 別名]
# 或者: from app.Application import __init__ [as 別名]
    def __init__(self):
        #initialize Application
        Application.__init__(self)

        self.bounds = self.screen.get_rect()
        #won't produce more than max_ships
        self.ships = ShipGroup(self.max_ships) #Sprite Group, makes sprite fxn (collision) easier
        self. spawners = [ TieSpawner(1000, self.ships, self.bounds),
                           YWingSpawner(2000, self.ships, self.bounds)]
        self.xplos = ExplosionGroup()
開發者ID:abonarrigo621,項目名稱:CS112-Spring2012,代碼行數:12,代碼來源:main.py

示例5: __init__

# 需要導入模塊: from app import Application [as 別名]
# 或者: from app.Application import __init__ [as 別名]
    def __init__(self, options):
        pygame.init()
        pygame.display.set_mode(settings.SCREEN_SIZE)
        pygame.display.set_caption(settings.CAPTION)

        self.nick = options["nick"]
        self.addr = options["addr"]
        self.port = options["port"]

        self.factory = NetworkControllerFactory(self)
        Application.__init__(self, ConnectingState)
開發者ID:HampshireCS,項目名稱:CS112-Spring2012,代碼行數:13,代碼來源:client.py

示例6: __init__

# 需要導入模塊: from app import Application [as 別名]
# 或者: from app.Application import __init__ [as 別名]
    def __init__(self):
        Application.__init__(self)

        self.bounds = self.screen.get_rect()
        self.ships = ShipGroup(self.max_ships)
        self.bullets = ShipGroup(self.max_ships)
        self.xplos = ExplosionGroup()
        self.score = 0
        self.player = Player(400, 560, 20, 20, self.bounds, (255, 255, 255))
        Explosion.group = self.xplos

        self.spawners = [TieSpawner(1000, self.ships, self.bounds), YWingSpawner(2000, self.ships, self.bounds)]
開發者ID:jwsander,項目名稱:CS112-Spring2012,代碼行數:14,代碼來源:main.py

示例7: __init__

# 需要導入模塊: from app import Application [as 別名]
# 或者: from app.Application import __init__ [as 別名]
    def __init__(self):
        Application.__init__(self)

        self.screenRect = self.screen.get_rect()
        
        self.minDt = 200
        self.enemyGroup = Group()
        self.enemyGroup.add(BasicEnemy(100,100,0,1,self.screenRect,80))

        self.bulletGroup = Group()

        self.player = Player(self.screenRect)
        self.playerGroup = GroupSingle(self.player)
        self.playerWeaponType = 1
        self.playerFired = False
        self.playerMoveX = 0
        self.playerMoveY = 0
        self.playerMoveFlag = False
開發者ID:habahut,項目名稱:CS112-Spring2012,代碼行數:20,代碼來源:Raiden.py

示例8: __init__

# 需要導入模塊: from app import Application [as 別名]
# 或者: from app.Application import __init__ [as 別名]
    def __init__(self):
        Application.__init__(self)

        self.bounds = self.screen.get_rect()
        self.shipGroup = Group()
        self.playerBulletGroup = Group()
        self.bulletGroup = Group()

        

        self.enemySpawners = [ ShipSpawner(5000, self.shipGroup, self.bounds),
                          ShipSpawner(10000, self.shipGroup, self.bounds, LeetEnemy) ]

        self.enemySpawners[1].setOrigin(40,40)

        self.player = Player()
        self.playerGroup = pygame.sprite.GroupSingle(self.player)
        self.playerFired = 0,0
開發者ID:habahut,項目名稱:CS112-Spring2012,代碼行數:20,代碼來源:raiden.py

示例9: __init__

# 需要導入模塊: from app import Application [as 別名]
# 或者: from app.Application import __init__ [as 別名]
 def __init__(self):
     Application.__init__(self)
     pygame.key.set_repeat(100,100)
     
     self.gameover = False
     self.kills = 0
     
     self.ships = Group()
     self.bullets = Group()
     self.player_bullets = BulletGroup(10)
     self.spawners = [   BadGuySpawner(100, self.ships, self.bounds, self.bullets),
                         FastGuySpawner(250, self.ships, self.bounds, self.bullets),
                         MadGuySpawner(300, self.ships, self.bounds, self.bullets)]
     
     self.player = Player(self.screen_size[0]/2, self.screen_size[1]-25, 0, 0, self.bounds, self.player_bullets)
             
     self.killed_text = UpdateText("Killed: ", self.kills, (self.screen_size[0]-100, self.screen_size[1]-25), 30)
     self.lives_text = UpdateText("Lives: ", self.player.lives, (10, self.screen_size[1]-25), 30)
開發者ID:maedayx,項目名稱:CS112-Spring2012,代碼行數:20,代碼來源:main.py

示例10: __init__

# 需要導入模塊: from app import Application [as 別名]
# 或者: from app.Application import __init__ [as 別名]
    def __init__(self):
        Application.__init__(self)

        self.bounds = self.screen.get_rect()
        self.ships = ShipGroup(self.max_ships)
        self.xplos = ExplosionGroup()
開發者ID:jlevey3,項目名稱:CS112-Spring2012,代碼行數:8,代碼來源:main.py

示例11: __init__

# 需要導入模塊: from app import Application [as 別名]
# 或者: from app.Application import __init__ [as 別名]
 def __init__(self):
     Application.__init__(self)
     self.bounds = self.screen.get_rect()
     self.player = Player(380, 740, 6, 6, self.bounds)
開發者ID:FrankHorrigan,項目名稱:CS112-Spring2012,代碼行數:6,代碼來源:shmup.py

示例12: __init__

# 需要導入模塊: from app import Application [as 別名]
# 或者: from app.Application import __init__ [as 別名]
    def __init__(self):
        Application.__init__(self)

        self.bounds = self.screen.get_rect()
開發者ID:BeefCakes,項目名稱:CS112-Spring2012,代碼行數:6,代碼來源:main.py


注:本文中的app.Application.__init__方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。