def _init_levelpoints( self, game_data, cheat = False ): self.lines = [[(162, 399), (127, 374), (99, 352)], [(58, 354), (49, 287), (55, 235), (64, 210), (89, 196), (123, 196)], [(156, 194), (149, 156), (133, 123), (109, 101), (81, 95), (62, 95)], [(129, 61), (160, 51), (185, 45), (218, 48), (251, 57), (278, 60)], [(319, 67), (334, 96), (348, 121), (348, 142), (342, 159), (326, 167)], [(286, 186), (289, 205), (294, 228), (312, 267)], [(324, 278), (341, 292), (367, 309), (395, 320), (422, 322), (450, 314), (484, 295), (503, 273)], [(472, 260), (497, 244), (529, 232), (552, 204), (556, 171), (532, 158)], [(472, 162), (437, 154), (406, 137), (407, 112), (418, 92), (451, 81), (494, 73), (524, 78), (701, 103), (729, 121), (739, 155), (725, 181), (702, 186), (676, 177), (650, 171), (641, 182), (640, 213), (655, 232)], [(750, 214), (733, 240), (717, 270), (692, 289), (662, 318), (641, 349), (646, 372)], [(732, 393), (696, 421), (657, 453)]] # self.lines = [[(98, 443), (165, 372)], [(200, 384), (281, 323), (267, 295)], [(189, 315), (105, 302), (138, 264), (222, 254)], [(257, 270), (306, 216), (262, 184)], [(202, 218), (116, 205), (103, 163), (209, 146), (281, 119)], [(322, 131), (400, 110), (435, 131), (407, 159)], [(386, 155), (379, 189), (448, 219), (457, 241)], [(484, 238), (497, 269), (472, 292), (424, 295)], [(399, 291), (390, 323), (478, 337), (565, 308)], [(575, 305), (582, 270), (601, 259), (559, 245), (565, 227)], [(584, 222), (588, 200), (554, 182)], [(535, 190), (489, 157), (526, 130), (523, 113), (566, 89), (699, 84), (751, 95), (762, 115), (739, 141), (745, 159), (678, 196), (693, 230)], [(710, 238), (694, 277)], [(682, 281), (684, 308), (744, 326), (757, 370), (737, 394)], [(706, 385), (667, 449)]] self.lines_length = 0.0 for seq in self.lines: for i in range( 0, len(seq) - 1 ): a = Vec2D( seq[i][0], seq[i][1] ) b = Vec2D( seq[i+1][0], seq[i+1][1] ) diff = a - b self.lines_length += diff.length() self.levelpoints = Radiobuttons() total_points = game_data.quest.get_level_count() config = Configuration.get_instance() for i in range( total_points ): sprite = resman.get("gui.levelpoint_sprite").clone() levelpoint = ImageCheckbox( sprite, self._get_point_place(i, total_points) ) levelpoint.is_enabled = (i <= config.unlocked_level) or cheat self.levelpoints.append( levelpoint )
def run( self ): config = Configuration.get_instance() monkey = Monkey( config ) while not monkey.user_exit: print "starting monkey at", datetime.today() monkey = Monkey( config ) try: monkey.run( 60 * 5 ) print "stopped monkey at", datetime.today() except Exception, ex: info = sys.exc_info() traceback.print_exception(info[0], info[1], info[2]) time.sleep(3) print
def run(self): config = Configuration.get_instance() monkey = Monkey(config) while not monkey.user_exit: print "starting monkey at", datetime.today() monkey = Monkey(config) try: monkey.run(60 * 5) print "stopped monkey at", datetime.today() except Exception, ex: info = sys.exc_info() traceback.print_exception(info[0], info[1], info[2]) time.sleep(3) print
def __init__( self, game_data ): super(type(self), self).__init__() self.game_data = game_data self._is_done = False self.should_quit = False btnFont = Font( "data/edmunds.ttf", color=(0,0,0), size=30, use_antialias = True ) BUTTON_X = 550 BUTTON_Y = 180 H = 65 self.adventure_btn = ImageButton( copy.copy(resman.get("game.button01_sprite")), Vec2D(BUTTON_X, BUTTON_Y) ) self.adventure_btn.set_label(_("Adventure"), btnFont ) self.quick_play = ImageButton( copy.copy(resman.get("game.button01_sprite")), Vec2D(BUTTON_X, BUTTON_Y + H) ) self.quick_play.set_label( _("Quick play"), btnFont ) self.multiplayer_btn = ImageButton( copy.copy(resman.get("game.button01_sprite")), Vec2D(BUTTON_X, BUTTON_Y + 2*H) ) self.multiplayer_btn.set_label( _("Multiplayer"), btnFont ) self.options_btn = ImageButton( copy.copy(resman.get("game.button01_sprite")), Vec2D(BUTTON_X, BUTTON_Y + 3*H) ) self.options_btn.set_label( _("Options"), btnFont ) self.quit_btn = ImageButton( copy.copy(resman.get("game.button01_sprite")), Vec2D(BUTTON_X, BUTTON_Y + 4*H) ) self.quit_btn.set_label( _("Quit"), btnFont ) if Configuration.get_instance().unlocked_level == 0: self.quick_play.is_enabled = False self.multiplayer_btn.is_enabled = False self.add_subcomponent( self.adventure_btn ) self.add_subcomponent( self.quick_play ) self.add_subcomponent( self.multiplayer_btn ) self.add_subcomponent( self.options_btn ) self.add_subcomponent( self.quit_btn ) self.update_neighbors() self.dialog = None self.background = resman.get("gui.logo_surf") self.crate_hud = CrateHud( game_data ) self.car_animation = CarAnimation()
def __init__( self, game_data ): Dialog.__init__( self, Rectangle(140, 80, 800-200, 600-200 ) ) self.background_image = resman.get("gui.paperdialog_surf") self._is_done = False self.game_data = game_data self.config = Configuration.get_instance() btnFont = Font( "data/edmunds.ttf", color=(0,0,0), size=32, use_antialias = True ) # Game speed, Scroll speed, Single Button mode self.speed0_lbl = Label( Vec2D(200, 140), _("Game"), btnFont ) self.speed1_lbl = Label( Vec2D(200, 170), _("Speed"), btnFont ) star = ImageButton( copy.copy(resman.get("gui.sheriffstar_sprite") ) ) self.speed_slider = ImageSlider( Vec2D( 320, 170 ), copy.copy(resman.get("gui.slider_sprite")), star ) self.oneswitch_btn = ImageButton( copy.copy(resman.get("game.button02_sprite")), Vec2D(300,240) ) self.update_oneswitch_label() self.scan0_lbl = Label( Vec2D(200, 310), _("Scan"), btnFont ) self.scan1_lbl = Label( Vec2D(200, 340), _("Speed"), btnFont ) star = ImageButton( copy.copy(resman.get("gui.sheriffstar_sprite") ) ) self.scan_slider = ImageSlider( Vec2D( 320, 340 ), copy.copy(resman.get("gui.slider_sprite")), star ) self.close_btn = ImageButton( copy.copy(resman.get("game.button02_sprite")), Vec2D(300,400) ) self.close_btn.set_label( _("Close"), btnFont ) self.add_subcomponent( self.speed0_lbl ) self.add_subcomponent( self.speed1_lbl ) self.add_subcomponent( self.speed_slider ) self.add_subcomponent( self.oneswitch_btn ) self.add_subcomponent( self.scan0_lbl ) self.add_subcomponent( self.scan1_lbl ) self.add_subcomponent( self.scan_slider ) self.add_subcomponent( self.close_btn ) self.speed_slider.set_value( self.config.game_speed ) self.scan_slider.set_value( 1.0 - ((self.config.scan_speed - 20) / float(40)) ) self.update_neighbors()
def __init__( self, game_data ): super(type(self), self).__init__( Rectangle(140, 80, 800-200, 600-200 ) ) self.background_image = resman.get("gui.paperdialog_surf") self._is_done = False self.game_data = game_data self.dialog = None self.config = Configuration.get_instance() btnFont = Font( "data/edmunds.ttf", color=(0,0,0), size=32, use_antialias = True ) self.sound_lbl = Label( Vec2D(200, 130), _("Sound"), btnFont ) star = ImageButton( copy.copy(resman.get("gui.sheriffstar_sprite") ) ) self.sound_slider = ImageSlider( Vec2D( 320, 140 ), copy.copy(resman.get("gui.slider_sprite")), star ) self.music_lbl = Label( Vec2D(200, 195), _("Music"), btnFont ) star = ImageButton( copy.copy(resman.get("gui.sheriffstar_sprite") ) ) self.music_slider = ImageSlider( Vec2D( 320, 205 ), copy.copy(resman.get("gui.slider_sprite")), star ) self.fullscreen_btn = ImageButton( copy.copy(resman.get("game.button02_sprite")), Vec2D(300,260) ) self.update_fullscreen_label() self.access_btn = ImageButton( copy.copy(resman.get("game.button02_sprite")), Vec2D(300,340) ) self.access_btn.set_label( _("Accessibility"), btnFont ) self.close_btn = ImageButton( copy.copy(resman.get("game.button02_sprite")), Vec2D(300,420) ) self.close_btn.set_label( _("Close"), btnFont ) self.add_subcomponent( self.sound_lbl ) self.add_subcomponent( self.sound_slider ) self.add_subcomponent( self.music_lbl ) self.add_subcomponent( self.music_slider ) self.add_subcomponent( self.fullscreen_btn ) self.add_subcomponent( self.access_btn ) self.add_subcomponent( self.close_btn ) self.sound_slider.set_value( SoundManager.get_sound_volume() ) self.music_slider.set_value( SoundManager.get_music_volume() ) self.update_neighbors()
try: monkey.run( 60 * 5 ) print "stopped monkey at", datetime.today() except Exception, ex: info = sys.exc_info() traceback.print_exception(info[0], info[1], info[2]) time.sleep(3) print if __name__ == '__main__': try: if "run" in sys.argv[1:]: monkeyMaster = MonkeyMaster() monkeyMaster.run() else: replay_file = None for f in os.listdir(os.getcwd()): if f.startswith("monkeyFailed"): replay_file = f break if replay_file is not None: monkey = Monkey( Configuration.get_instance(), replay_file ) monkey.run() else: print "No failed files!" except Exception, ex: print "megaexcept!!!!!!"
try: monkey.run(60 * 5) print "stopped monkey at", datetime.today() except Exception, ex: info = sys.exc_info() traceback.print_exception(info[0], info[1], info[2]) time.sleep(3) print if __name__ == '__main__': try: if "run" in sys.argv[1:]: monkeyMaster = MonkeyMaster() monkeyMaster.run() else: replay_file = None for f in os.listdir(os.getcwd()): if f.startswith("monkeyFailed"): replay_file = f break if replay_file is not None: monkey = Monkey(Configuration.get_instance(), replay_file) monkey.run() else: print "No failed files!" except Exception, ex: print "megaexcept!!!!!!"