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


Python State.__init__方法代码示例

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


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

示例1: __init__

# 需要导入模块: from state import State [as 别名]
# 或者: from state.State import __init__ [as 别名]
 def __init__(self, monster):
     from elements import Rectangle
     State.__init__(self)
     full_rect = Rectangle(colour = (0, 0, 0), thickness = 4, x_index = 0, y_index = 0, x_tiles = 10, y_tiles = 10)
     rect = Rectangle(colour = (0, 0, 0), thickness = 2, x_index = 0.25, y_index = 7.75, x_tiles = 9.5, y_tiles = 2)
     self._shapes = [full_rect, rect]
     return
开发者ID:doug3230,项目名称:Slayer,代码行数:9,代码来源:battle_state.py

示例2: __init__

# 需要导入模块: from state import State [as 别名]
# 或者: from state.State import __init__ [as 别名]
 def __init__(self, screen, inputManager):
     State.__init__(self, screen, inputManager)
     inputManager.attach(self.player)
     
     self.board_bounds = pygame.Rect(0,0,950,600)
     
     self.fontObj = pygame.font.Font('freesansbold.ttf', 22)
开发者ID:rafasimao,项目名称:SpaceInvaders,代码行数:9,代码来源:state_game.py

示例3: __init__

# 需要导入模块: from state import State [as 别名]
# 或者: from state.State import __init__ [as 别名]
 def __init__(self, current=0):
     State.__init__(self)
     self.ui = UI(self, Jules_UIContext)
     self.nextState = GameStart
     logo_duration = 20 * 1000
     scores_duration = 5 * 1000
     self.displays = [(logo_duration, self.draw_logo),
                     (scores_duration, self.draw_high_scores)]
     self.eventid = TimerEvents.SplashScreen
     self.current = current
     self.draw = self.displays[self.current][1]
     self.instructions = ['Can you think fast and react faster?',
                          'This game will test both.',
                          'Your job is to destroy the bonus blocks.',
                          'Sounds easy, right?... Wrong!',
                          'There are several problems.',
                          'If you destroy a penalty block you lose 200 pts.',
                          'If you get 3 penalties, you lose a life.',
                          'If you lose 3 lives, the game is over.',
                          'The bonus and penalty blocks',
                          'change colors every 5 seconds.',
                          'And on top of that, if you do not destroy a',
                          'random non-bonus, non-penalty block every',
                          'couple of seconds, that will give you a',
                          'penalty too. Think you got all that?']
开发者ID:CodeSkool,项目名称:SimpleGUI2Pygame,代码行数:27,代码来源:React.py

示例4: __init__

# 需要导入模块: from state import State [as 别名]
# 或者: from state.State import __init__ [as 别名]
    def __init__(self, surf, prev):
        """

        :param surf:
        :param prev:
        """
        State.__init__(self, surf, prev)
开发者ID:Pafycio,项目名称:Pendomotion,代码行数:9,代码来源:menu_state.py

示例5: __init__

# 需要导入模块: from state import State [as 别名]
# 或者: from state.State import __init__ [as 别名]
 def __init__(self, screen, inputManager, character):
     State.__init__(self, screen, inputManager)
     self.character = character;
     
     
     self.width, self.height = self.screen.get_width(), self.screen.get_height()    
     pygame.display.set_caption("StepFight - Items Menu")
     
     #Items Box dimensions
     self.item_width, self.item_height = 250, 200
     self.item_screen = self.item_width, self.item_height
     
     #Fonts
     self.font_object = pygame.font.Font('freesansbold.ttf', 20)
     
     self.next_state = Consts.STATE_CONTINUE
     
     #Play button
     self.play_button = self._createButton(self.PLAY_BUTTON, Consts.PLAY, (700,525,200,50))
     self.play_button.font_object = pygame.font.Font('freesansbold.ttf', 35)
     self.play_button._setPadding(50, 10)
 
     #Buy buttons
     self.buy_sword_button = self._createButton(self.BUY_SWORD_BUTTON, Consts.BUY, (75, 200,100,40))
     self.buy_helmet_button = self._createButton(self.BUY_HELMET_BUTTON, Consts.BUY, (525, 200,100,40))
     self.buy_armor_button = self._createButton(self.BUY_ARMOR_BUTTON, Consts.BUY, (75, 450,100,40))
     self.buy_spell_button = self._createButton(self.BUY_SPELL_BUTTON, Consts.BUY, (525, 450,100,40))
开发者ID:alfonsoaranzazu,项目名称:StepFight,代码行数:29,代码来源:stateItemsBoard.py

示例6: __init__

# 需要导入模块: from state import State [as 别名]
# 或者: from state.State import __init__ [as 别名]
 def __init__(self, window, *args, **kwargs):
     print "++++ new level intro state"
     script_name = kwargs["script_name"]
     State.__init__(self, window, "scripted%s" % script_name, *args, **kwargs)
     self.build_scene()
     self.script = kwargs["script"][:]
     self.running_text = False
     self.band_pic = None
开发者ID:chris-statzer,项目名称:genomehero,代码行数:10,代码来源:transitions.py

示例7: __init__

# 需要导入模块: from state import State [as 别名]
# 或者: from state.State import __init__ [as 别名]
 def __init__(self, screen, inputManager, client):
     State.__init__(self, screen, inputManager)
     self.client = client
     inputManager.attach(self)
     
     self.board_bounds = pygame.Rect(0,0,screen.get_width(),screen.get_height())
     
     self.fontObj = pygame.font.Font('freesansbold.ttf', 22)
开发者ID:rafasimao,项目名称:SpaceInvadersCS,代码行数:10,代码来源:state_game.py

示例8: __init__

# 需要导入模块: from state import State [as 别名]
# 或者: from state.State import __init__ [as 别名]
 def __init__(self):
     State.__init__(self)
     self._shapes = shapes()
     self._sprites = sprites()
     self._sword = sword()
     self._sword_top_index = self._sword.y_index
     self._number_of_choices = 2
     self._current_choice = 0 
     return
开发者ID:doug3230,项目名称:Slayer,代码行数:11,代码来源:title_state.py

示例9: __init__

# 需要导入模块: from state import State [as 别名]
# 或者: from state.State import __init__ [as 别名]
  def __init__(self, disp, width, height):
    State.__init__(self, disp)
    
    self.initWorld(width, height)

    self.initGui()
    
    self.registerInputHandlers()
    self.update()
开发者ID:v4nz666,项目名称:flaming-hipster,代码行数:11,代码来源:generateworld.py

示例10: __init__

# 需要导入模块: from state import State [as 别名]
# 或者: from state.State import __init__ [as 别名]
 def __init__(self, start, screen, inputManager): 
     State.__init__(self, screen, inputManager)
     
     self.start = start
     
     self.board_bounds = pygame.Rect(0,0, 950, 600)
     
     self.fontObj1 = pygame.font.Font('freesansbold.ttf', 42)
     self.fontObj2 = pygame.font.Font('freesansbold.ttf', 24)
开发者ID:rafasimao,项目名称:SpaceInvaders,代码行数:11,代码来源:state_game_intro.py

示例11: __init__

# 需要导入模块: from state import State [as 别名]
# 或者: from state.State import __init__ [as 别名]
 def __init__(self, disp):
   State.__init__(self,disp)
   self.inputHandler = input.NonBlockingKeyboardHandler()
   self.inputHandler.initInputs(
     {
       'quit': {
         'key':libtcod.KEY_ESCAPE,
         'ch': None,
         'fn': self.quitToMenu
       },
       'mvUp': {
         'key': libtcod.KEY_KP8,
         'ch': None,
         'fn': self.mvUp
       },
       'mvDn': {
         'key': libtcod.KEY_KP2,
         'ch': None,
         'fn': self.mvDn
       },
       'mvRgt': {
         'key': libtcod.KEY_KP6,
         'ch': None,
         'fn': self.mvRgt
       },
       'mvLft': {
         'key': libtcod.KEY_KP4,
         'ch': None,
         'fn': self.mvLft
       },
       'mvUpLft': {
         'key': libtcod.KEY_KP7,
         'ch': None,
         'fn': self.mvUpLft
       },
       'mvUpRgt': {
         'key': libtcod.KEY_KP9,
         'ch': None,
         'fn': self.mvUpRgt
       },
       'mvDnLft': {
         'key': libtcod.KEY_KP1,
         'ch': None,
         'fn': self.mvDnLft
       },
       'mvDnRgt': {
         'key': libtcod.KEY_KP3,
         'ch': None,
         'fn': self.mvDnRgt
       },
       
       'toggleRope': {
         'key': libtcod.KEY_SPACE,
         'ch': None,
         'fn': self.ropeToggle
       }
   })
开发者ID:v4nz666,项目名称:flaming-hipster,代码行数:59,代码来源:play.py

示例12: __init__

# 需要导入模块: from state import State [as 别名]
# 或者: from state.State import __init__ [as 别名]
 def __init__(self, surf, prev):
     State.__init__(self, surf, prev)
     self.generator = self.prev_state.random
     self.max_trains = self.prev_state.train
     self.max_crash = self.prev_state.crash
     self.pause = False
     self.end = False
     self.map_controller = ControlMap()
     self.map_controller.load_map(self.prev_state.cur_map)
     self.map_controller.set_train_generator(self.generator)
开发者ID:Pafycio,项目名称:Pendomotion,代码行数:12,代码来源:game_state.py

示例13: __init__

# 需要导入模块: from state import State [as 别名]
# 或者: from state.State import __init__ [as 别名]
 def __init__(self, lives=3, score=0, penalties=0):
     State.__init__(self)
     self.ui = UI(self, Jules_UIContext)
     self.nextState = None
     self.eventid = TimerEvents.Playing
     self.score = score
     self.lives = lives
     self.penalties = penalties
     self.countdown = 5 * 1000
     self.penalties_per_life = 3
     self.start_time = pygame.time.get_ticks()
开发者ID:CodeSkool,项目名称:SimpleGUI2Pygame,代码行数:13,代码来源:ReactTemplate.py

示例14: __init__

# 需要导入模块: from state import State [as 别名]
# 或者: from state.State import __init__ [as 别名]
 def __init__(self, surf, prev):
     """
     :param surf:
     :param prev:
     :return:
     """
     State.__init__(self, surf, prev)
     self.random = True
     self.train = 6
     self.crash = 4
     self.cur_map = 1
开发者ID:Pafycio,项目名称:Pendomotion,代码行数:13,代码来源:create_game_state.py

示例15: __init__

# 需要导入模块: from state import State [as 别名]
# 或者: from state.State import __init__ [as 别名]
 def __init__(self, window, level, diff, pair_generator, win_conditions, *args, **kwargs):
     print "++++ new game state"
     self.level = level
     self.diff = diff
     self.pair_generator = pair_generator
     self.win_conditions = win_conditions
     State.__init__(self, window, "game", *args, **kwargs)
     self.build_scene()
     self.current_rung = None
     self.longest_streak = 0
     self.time = 0
     self.mutation_counter = 0
开发者ID:chris-statzer,项目名称:genomehero,代码行数:14,代码来源:gamestate.py


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