Пример #1
0
        if time_elapsed % frequency == 0:
            new_box()

        #### User Action ###
        if k == Game.ESCAPE:
            g.pause()
        elif k == Game.SPACE:
            fire()
        elif k == Game.ARROW_UP:
            jump()
        elif k == Game.ARROW_DOWN:
            crouch()
        elif k == Game.ARROW_LEFT:
            left()
        elif k == Game.ARROW_RIGHT:
            right()

        # Update movement of boxes
        k = g.next_frame(delay)

        check_borders()
        # Check for end of frames and collisions
        check_collisions()
        check_hit()


try:
    run()
except KeyboardInterrupt:
    g.quit(dino, score)
Пример #2
0
g.next_frame(250)

# remove box
g.destroy_box(box5)
g.next_frame(250)

# remove box
g.destroy_box(box4)
g.next_frame(250)

# remove box multiple boxes
g.destroy_box(box3)
g.destroy_box(box2)
g.next_frame(250)

# create new boxes for collision
box2 = g.create_box(4, 4, -2, -2)
box3 = g.create_box(4, 4, 13, 13)
g.next_frame(250)

if box.collision(box2):
    g.destroy_box(box2)
g.next_frame(250)

if box.collision(box3):
    g.destroy_box(box3)
g.next_frame(250)

g.next_frame(1000)
g.quit()