from game_engine import Game import time g = Game(log=True) # create box in frame box = g.create_box(4, 4, 10, 10) g.next_frame(250) # create box top left box2 = g.create_box(4, 4, -2, -2) g.next_frame(250) # create box top right box3 = g.create_box(4, 4, g.width - 2, -2) g.next_frame(250) # create box bottom left box4 = g.create_box(4, 4, -2, g.height - 2) g.next_frame(250) # create box bottom right box5 = g.create_box(4, 4, g.width - 2, g.height - 2) g.next_frame(250) # create box outside box6 = g.create_box(4, 4, -10, -10) g.next_frame(600) # remove box outside of frame g.destroy_box(box6)
#### User Action ### #if k is None: #print(time_elapsed) # a=0 #elif k == Game.SPACE_KEY: #print("space key pressed") # g.jump() #score_box.set_text("test: %d"% time_elapsed) # try: # while True: # pass # except: # pass k = g.next_frame(delay) # enter delay in ms score_box.set_text("keypress: %d" % k) # Check for collisions and end of frames for _box in boxes: if _box.x + _box.width == 0: boxes.remove(_box) g.destroy_box(_box) if _box.x < 15: collision = _box.collision(dino) if collision and False: g.destroy_box(_box) g.quit() exit(0)