本文整理汇总了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
示例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)
示例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?']
示例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)
示例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))
示例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
示例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)
示例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
示例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()
示例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)
示例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
}
})
示例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)
示例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()
示例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
示例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