def main(): screen.set_size(640, 640) screen.set_event(6, on_mouse_down) create_blocks(10, 10) while not screen.closed: screen.run()
def main(args): if args.learn is not None: learning.offline_learning(args.learn) if args.run == True: if args.server == None: screen.run() else: screen.run(args.server)
def main(): screen.set_size(640, 640) screen.set_caption('Mine') screen.set_event('MouseButtonDown', on_mouse_down) screen.set_event('KeyDown', on_key_down) create_blocks(10, 10) while not screen.closed(): screen.run() # exit print("end")
if __name__ == '__main__': # init screen.set_backdrop('./pics/grass.jpg') screen.set_event('MouseButtonDown', on_mouse_down) # screen.set_event('KEYDOWN', on_key_down) tank = screen.create_sprite('tank') tank.set_costume('./pics/tank12.png') tank.move_to(300, 300) # main-loop speed = 2 while not screen.closed: tick = screen.run() if screen.key_pressed('up'): tank.point_dir(0, rotate=True) tank.move(speed) elif screen.key_pressed('down'): tank.point_dir(180, rotate=True) tank.move(speed) elif screen.key_pressed('left'): tank.point_dir(270, rotate=True) tank.change_x(-speed) elif screen.key_pressed('right'): tank.point_dir(90, rotate=True) tank.change_x(speed) elif screen.key_pressed('space'): tank.point_mouse(rotate=True) tank.move(speed)