def __init__(self): self.timer = pygame.time.Clock() self.display = pygame.display.get_surface() self.level_manager = state.StateMachine(self, level.Level()) self.player = player.Player() Game.player = self.player self.hud_manager = state.StateMachine( self, hud.Hud(self, self.player, self.timer)) self.background = pygame.image.load( "data/images/city.png").convert_alpha() surface_manager.add(self.player) self.music = pygame.mixer.Sound("data/sound/game.wav") self.music.play(loops=-1)
def __init__(self): self.timer = pygame.time.Clock() self.display = pygame.display.get_surface() self.level_manager = state.StateMachine(self, level.Level()) self.player = player.Player() Game.player = self.player self.hud_manager = state.StateMachine( self, hud.Hud(self, self.player, self.timer)) #Loads the background image self.background = pygame.image.load( "data/images/menu_background.jpg").convert() #Adds the player's character to the game window surface_manager.add(self.player) pygame.display.update
def __init__(self): self.timer = pygame.time.Clock() self.display = pygame.display.get_surface() displayWidth = self.display.get_width() displayHeight = self.display.get_height() self.player = player.Player() Game.player = self.player self.level_manager = state.StateMachine(self,level.Level()) self.hud_manager = state.StateMachine(self, hud.Hud(self, self.player, self.timer)) self.background = load_image(getGameBackground()) self.background = pygame.transform.scale(self.background,(displayWidth,displayHeight)) surface_manager.add(self.player) self.player.startGame() self.music = load_sound(getGameSound()) self.music.play(loops=-1)
def __init__(self): self.timer = pygame.time.Clock() self.display = pygame.display.get_surface() self.level_manager = state.StateMachine(self, level.Level()) self.player = player.Player() Game.player = self.player self.hud_manager = state.StateMachine( self, hud.Hud(self, self.player, self.timer)) self.background = pygame.image.load( 'data/images/background_frame2.png') surface_manager.add(self.player) self.music2 = pygame.mixer.Sound("data/sound/THEME_SONG.wav") self.music2.play(loops=-1)
def __init__(self): self.states = ("state_1", "state_2") state_dict = { self.states[0]: StateManagment.ExampleState1, self.states[1]: StateManagment.ExampleState2 } self.game_state = StateManagment.StateMachine(self, state_dict) self.game_state.change('state_1')
def __init__(self): super(MyoDrone, self).__init__('ws://127.0.0.1:10138/myo/3', protocols=['http-only', 'chat']) self._drone = libardrone.ARDrone2() self._state_machine = state.StateMachine() self._state_machine.add_state(TakeOffState(self._drone)) self._state_machine.add_state(ConnectState()) self._state_machine.add_state(PairState()) self.connect()
def start(self, data): self._drone.takeoff() self._start_time = time.time() self._started = False ''' self._plotX = win.addPlot(title="Vx") self._curveX = self._plotX.plot(pen='y') self._plotY = win.addPlot(title="Vy") self._curveY = self._plotY.plot(pen='y') self._plotZ = win.addPlot(title="Vz") self._curveZ = self._plotZ.plot(pen='y') self._plotAngle = win.addPlot(title="Angle") self._curveAngle = self._plotAngle.plot(pen='y') ''' data = {'x': 0, 'y': 0, 'z': 0} self._state_machine = state.StateMachine() self._state_machine.add_state(OrientationState(self._drone, data)) self._state_machine.add_state(LandState(self._drone)) print('waiting')
pass class InteractionToGameTransition(state.Transition): def execute(self): pass # Setup the console text tcod.console_set_custom_font( "terminal10x16_gs_tc.png", tcod.FONT_LAYOUT_TCOD, ) # Setup the console main window gRootConsole = tcod.console_init_root(gWidth,gHeight,order="F") # Setup main state machine gFSM = state.StateMachine() gFSM.states = { "intro" : GameState.Intro(gFSM), "game" : GameState.Game(gFSM), "gameover" : GameState.GameOver(gFSM) } gFSM.transitions = { "from_intro_to_game" : GameTransition.IntroToGameTransition(gFSM, "intro", "game"), "from_interaction_to_game" : GameTransition.InteractionToGameTransition(gFSM, "interaction", "game"), } gFSM.set_state("intro") print(gFSM.cur_state) sleeptime = 1 / 30 time_cumul = 0 while True:
def __init__(self): self.sm = state.StateMachine(self, title.Title())
def __init__(self, caption): pygame.init() self.display = pygame.display.set_mode((800, 600)) pygame.display.set_caption(caption) self.sm = state.StateMachine(self, title.Title())
def __init__(self): self.xkb = XKeyboard() self.controller = Controller() self.state = state.StateMachine() self.busy = False