def main(speed=1, fps=Game.fps, bounciness=Game.bounciness, debug_mode=False, draw_outlines=False): """ Initialize and run the game. keyword arguments: speed=1 Speed multiplier for the game (e.g. speed=2 is twice as fast) fps=60 Max FPS limiter (does not affect game speed) bounciness=0.9 Bounciness of objects (1: 100% elastic, 0: 0% elastic) debug_mode=False Flag to indicate 'debug mode' state draw_outlines=False If in debug_mode, draw collision outlines of objects instead of blitting an image """ debug._DebugMode = debug_mode debug.debug.DrawOutlines = draw_outlines Game.fps = min(max(fps, 10), 120) Game.bounciness = min(max(bounciness, 0), 1) Game._speed = min(max(speed, .01), 10) # Set up an SDL environment video parameter, required for pygame. os.environ['SDL_VIDEO_CENTERED'] = '1' pygame.init() game.init() Game.run()
def main(): actions = data_loading.load_action_sequence('check_door_key_interaction') action_delay = .05 input_delay = .5 def get_action_from_sequence(): sleep(action_delay) a = actions.get() return a def empty_input(prompt): print(prompt) sleep(input_delay) return run(get_action_from_sequence, empty_input)
from game import Game, game if __name__ == '__main__': game = Game() game.run(game)
def main(): run(get_action_by_key, input)
#!/usr/bin/env python2 import sys sys.path.append('/home/root/Documents/KISS/Default User/ths-botball-2019/') try: from src import __wallaby_local as w # for VSCode support except ImportError: import imp wallaby = imp.load_source('wallaby', '/usr/lib/wallaby.py') import wallaby as w # so it works on actual robot from helpers.functions import print_botball_logo from game import game print_botball_logo() game.run()
from game import game if __name__ == "__main__": game = game(800, 600, "Game!") game.run() sys.exit()