本文整理匯總了Python中statemachine.StateMachine.nextState方法的典型用法代碼示例。如果您正苦於以下問題:Python StateMachine.nextState方法的具體用法?Python StateMachine.nextState怎麽用?Python StateMachine.nextState使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類statemachine.StateMachine
的用法示例。
在下文中一共展示了StateMachine.nextState方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: StateMachine
# 需要導入模塊: from statemachine import StateMachine [as 別名]
# 或者: from statemachine.StateMachine import nextState [as 別名]
pygame.mixer.pre_init()
pygame.init() #initializes pygame. A must for every pygame program.
WHITE = (255, 255, 255)
BLACK = (0, 0, 0)
RED = (255, 0, 0)
#defining the colors ahead of time so I can easily call them when needed.
# === Init Stuff === #
# Here the statemachine object is created.
# stateDefault is set to be run as the first state.
buttonStateMachine = StateMachine()
buttonStateMachine.activeState = stateDefault
buttonStateMachine.nextState = stateDefault
# The different state functions are added to the states dictionary.
# the left part is the key, the right part the value
buttonStateMachine.states = {
'default': stateDefault,
'lookButton': stateLook,
'openButton': stateOpen,
'useButton': stateUse,
'goButton': stateGo
}
buttonDict = {
(0, 111, 500, 50): 'lookButton',
(113, 111, 500, 50): 'openButton',
(226, 111, 500, 50): 'useButton',
(338, 111, 500, 50): 'goButton'