当前位置: 首页>>代码示例>>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;未经允许,请勿转载。