Example #1
0
def place_bubble (x, colour):
    global currentColour, currentCircle
    currentColour = colour
    currentCircle = pge.circle (0.5, 0.21, 0.03, currentColour).mass (1.0)
    currentCircle.put_yvel (7.0)
    currentCircle.put_xvel ((0.5-x)*-6.0)
    pge.run (0.2)
Example #2
0
def main ():
    placeBox ([0.4, 0.4], 0.1, red).fix ()
    placeBoarders (boarder, wood_dark)
    placeBox ([0.47, 0.7], 0.1, blue)
    pge.gravity ()
    pge.run (3.0)
    pge.finish ()
Example #3
0
def main():
    placeBox([0.4, 0.4], 0.1, red).fix()
    placeBoarders(boarder, wood_dark)
    placeBox([0.47, 0.7], 0.1, blue)
    pge.gravity()
    pge.run(3.0)
    pge.finish()
Example #4
0
def main():
    global gb, winner, loser, seconds_left

    b1, b2, b3, b4 = placeBoarders(boarder, wood_dark)
    place_boxes()
    t1 = placeTriangle([0.2, 0.4], [0.4, 0.4], [0.3, 0.5], white)
    t2 = placeTriangle([0.6, 0.4], [0.8, 0.4], [0.7, 0.5], white)
    gb = placeBall(gold, 0.19, 0.8, 0.05).mass(1.25)

    print("before run")
    pge.gravity()
    # pge.dump_world ()
    pge.draw_collision(True, False)
    pge.slow_down(slowdown)  # slows down real time by a factor of
    pge.register_handler(myquit, [QUIT])
    pge.register_handler(key_pressed, [KEYDOWN])
    pge.register_handler(mouse_hit, [MOUSEBUTTONDOWN])
    pge.display_set_mode([800, 800])
    # pge.display_fullscreen (True)
    seconds_left = 10 * slowdown
    timer()
    pge.run(10.0)
    out_of_time()
    pge.run(4.0)
    pge.finish_record()
Example #5
0
def main():
    global gb, sides

    spring_power = 500.0
    damping = 1.0

    placeBoarders(0.01, wood_dark)

    left = placeBall(wood_light, 0.25, 0.65, 0.03).fix()
    right = placeBall(wood_light, 0.75, 0.65, 0.03).fix()

    prev = left
    for x in range(35, 75, 10):
        step = placeBall(wood_dark, float(x) / 100.0, 0.5, 0.04).mass(0.3)
        s = pge.spring(prev, step, spring_power, damping,
                       0.1).draw(yellow, 0.002)
        prev = step
    gb = placeBall(steel, 0.7, 0.95, 0.01).mass(1.0)
    fb1 = placeBall(blue_dark, 0.3, 0.8, 0.04).mass(0.3)
    fb2 = placeBall(red, 0.4, 0.8, 0.04).mass(0.3)
    fs = pge.spring(fb1, fb2, spring_power, damping, 0.1).draw(yellow, 0.002)
    print "before run"
    pge.record()
    pge.draw_collision(True, False)
    pge.collision_colour(red)
    pge.gravity()
    pge.dump_world()
    pge.slow_down(6.0)  # slows down real time by a factor of
    pge.register_handler(myquit, [QUIT])
    pge.register_handler(key_pressed, [KEYDOWN])
    pge.display_set_mode([1000, 1000])
    pge.run(10.0)
    pge.finish_record()
Example #6
0
def main():
    global gb, sides

    # f = placeBall (wood_light, 0.95, 0.05, 0.1).fix ()
    # l = placeBox ([0.3, 0.3], [0.3, 0.5], [0.5, 0.5], [0.5, 0.3], white)
    t1 = placeTriangle([0.2, 0.3], [0.4, 0.3], [0.3, 0.4], white)
    t2 = placeTriangle([0.6, 0.3], [0.8, 0.3], [0.7, 0.4], white)
    placeRamps()
    b1, b2, b3, b4 = placeBoarders(boarder, wood_dark)
    for b in [b1, b2, b3, b4]:
        b.on_collision(play_crack)
    box_of(boarder, [0.1, 0.08], 0.2, wood_light)
    #gb = placeBall (gold, 0.19, 0.7, 0.05).mass (1.25).on_collision_with (sides, delete_it)
    #sb = placeBall (steel, 0.57, 0.8, 0.05).mass (1).on_collision_with (sides, delete_it)
    #cb = placeBall (copper, 0.81, 0.8, 0.05).mass (.75).on_collision_with (sides, delete_it)
    placeSilos()

    placeBox([0.47, 0.7], 0.1, blue).mass(10.0)

    print("before run")
    pge.gravity()
    pge.dump_world()
    pge.draw_collision(True, False)
    pge.slow_down(6.0)  # slows down real time by a factor of
    pge.register_handler(myquit, [QUIT])
    pge.register_handler(key_pressed, [KEYDOWN])
    pge.register_handler(mouse_hit, [MOUSEBUTTONDOWN])
    pge.display_set_mode([800, 800])
    pge.run(18.0)
    pge.finish_record()
Example #7
0
def main():
    global gb, sides, winner, loser, seconds_left, slowdown, simulatedtime

    b1, b2, b3, b4 = placeBoarders(boarder, wood_dark)
    b1.on_collision(delete_ball)

    place_matchboxes()
    gb = placeBall(gold, 0.19, 0.8,
                   0.05).mass(1.25).on_collision_with(sides, delete_it)
    sb = placeBall(steel, 0.57, 0.75,
                   0.05).mass(1).on_collision_with(sides, delete_it)
    cb = placeBall(copper, 0.81, 0.7,
                   0.05).mass(.75).on_collision_with(sides, delete_it)
    placeSilos()

    print "before run"
    pge.gravity()
    # pge.dump_world ()
    pge.draw_collision(True, False)
    pge.slow_down(slowdown)  # slows down real time by a factor of
    pge.register_handler(myquit, [QUIT])
    pge.register_handler(key_pressed, [KEYDOWN])
    pge.register_handler(mouse_hit, [MOUSEBUTTONDOWN])
    pge.display_set_mode([800, 800])
    # pge.display_fullscreen (True)
    seconds_left = simulatedtime * slowdown
    timer()
    pge.run(simulatedtime)
    if not winner:
        loser = True
        pge.text(0.2, 0.3, "Loser", white, 100, 1)
        pge.at_time(4.0, finish_game)
    pge.run(4.0)
    pge.finish_record()
Example #8
0
def main ():
    global g, blue, steel, slowdown, seconds_left

    n, e, s, w = placeBoarders (boarder, wood_dark)
    s.on_collision (delete_ball)
    n.on_collision (bubble_hits_bar)

    print("before run")
    pge.gravity ()
    pge.dump_world ()
    pge.draw_collision (False, False)
    pge.slow_down (6.0)  # slows down real time by a factor of
    pge.fps (200)
    pge.display_set_mode ([800, 800])
    pge.register_handler (mouse_press, [MOUSEBUTTONDOWN])
    pge.register_handler (myquit, [QUIT])
    pge.register_handler (key_pressed, [KEYDOWN])

    createLevel ()

    seconds_left = 10 * slowdown
    timer ()
    pge.run (simulatedtime)
    pge.run (10.0)
    pge.finish_record ()
Example #9
0
def main ():
    global gb, sides

    placeBoarders (0.01, wood_dark)

    first = placeBall (wood_dark, 0.55, 0.95, 0.02).fix ()
    second = placeBall (wood_light, 0.36, 0.85, 0.02).mass (1.0)
    third = placeBall (wood_dark, 0.74, 0.52, 0.02).mass (1.0)
    fourth = placeBall (wood_dark, 0.4, 0.51, 0.02).mass (1.0)
    s = pge.spring (first, second, 100.0, 2.0, 0.03).draw (yellow, 0.002)
    s = pge.spring (second, third, 100.0, 2.0, 0.08).draw (yellow, 0.002)
    s = pge.spring (third, fourth, 100.0, 2.0, 0.08).draw (yellow, 0.002)
    print "before run"
    pge.record ()
    pge.draw_collision (False, False)
    pge.collision_colour (red)
    pge.gravity ()
    pge.dump_world ()
    pge.slow_down (6.0)  # slows down real time by a factor of
    pge.register_handler (myquit, [QUIT])
    pge.register_handler (key_pressed, [KEYDOWN])
    pge.display_set_mode ([800, 800])
    local_fps ()
    pge.run (20.0)
    pge.finish_record ()
Example #10
0
def main():
    global gb, sides

    spring_power = 100.0
    damping = 1.0

    placeBoarders(0.01, wood_dark)

    snap_length = 0.20

    top_left = placeBall(wood_light, 0.25, 0.85, 0.02).mass(0.1)
    top_right = placeBall(wood_light, 0.45, 0.80, 0.02).mass(0.1)
    bot_left = placeBall(wood_light, 0.25, 0.65, 0.02).mass(0.1)
    bot_right = placeBall(wood_light, 0.45, 0.60, 0.02).mass(0.1)
    s = [
        pge.spring(top_left, top_right, spring_power,
                   damping).draw(yellow, 0.002)
    ]
    s += [
        pge.spring(top_right, bot_right, spring_power,
                   damping).draw(yellow, 0.002)
    ]
    s += [
        pge.spring(bot_right, bot_left, spring_power,
                   damping).draw(yellow, 0.002)
    ]
    s += [
        pge.spring(bot_left, top_left, spring_power,
                   damping).draw(yellow, 0.002)
    ]
    s += [
        pge.spring(top_left, bot_right, spring_power,
                   damping).draw(yellow, 0.002)
    ]
    s += [
        pge.spring(bot_left, top_right, spring_power,
                   damping).draw(yellow, 0.002)
    ]
    for i in s:
        i.when(snap_length, snap_it)

    for i in range(2, 7):
        gb1 = placeBall(steel, float(i) / 10.0, 0.9, 0.01).mass(1.0)
    gb1 = placeBall(steel, 0.4, 0.9, 0.01).mass(1.0)
    ramp = pge.poly4(0.2, 0.3, 0.7, 0.33, 0.7, 0.36, 0.2, 0.33,
                     blue_dark).fix()
    print "before run"
    pge.record()
    pge.draw_collision(True, False)
    pge.collision_colour(red)
    pge.gravity()
    pge.dump_world()
    pge.slow_down(6.0)  # slows down real time by a factor of
    pge.register_handler(myquit, [QUIT])
    pge.register_handler(key_pressed, [KEYDOWN])
    pge.display_set_mode([1000, 1000])
    pge.run(10.0)
    pge.finish_record()
Example #11
0
def main():
    c = placeBall(0.41, 0.89, 0.05).mass(1)
    l = placeTriangle([0.3, 0.3], [0.5, 0.3], [0.4, 0.4])
    b1, b2, b3, b4 = placeBoarders(boarder, wood_dark)
    print("before run")
    pge.gravity()
    pge.dump_world()
    pge.run(3.0)
    pge.finish()
Example #12
0
def main ():
    c = placeBall (0.41, 0.89, 0.05).mass (1)
    l = placeTriangle ([0.3, 0.3], [0.5, 0.3], [0.4, 0.4])
    b1, b2, b3, b4 = placeBoarders (boarder, wood_dark)
    print "before run"
    pge.gravity ()
    pge.dump_world ()
    pge.run (3.0)
    pge.finish ()
Example #13
0
def main():
    c = placeBall(0.55, 0.8, 0.1).mass(1).on_collision(callMe)
    l = placeBox([0.3, 0.3], [0.3, 0.5], [0.5, 0.5], [0.5, 0.3])
    b1, b2, b3, b4 = placeBoarders(boarder, wood_dark)
    print("before run")
    pge.gravity()
    pge.dump_world()
    pge.run(3.0)
    pge.finish()
Example #14
0
def main ():
    c = pge.circle (0.5, 0.5, 0.3, white, -1)
    l = pge.box (0.0, 0.25, 1.0, 0.02, wood_light, 1)
    b1, b2, b3, b4 = placeBoarders (boarder, wood_dark)
    # b = placeBall (0.5, 0.5, 0.02)
    # b.mass (1.0).on_collision (play_bounce).velocity (0.9, 0.0)
    crate (0.6, 0.6, 0.2)
    print "before run"
    pge.gravity ()
    pge.dump_world ()
    pge.run (10.0)
    pge.finish ()
Example #15
0
def main():
    pge.slow_down(slowdown)  # slows down real time by a factor of
    pge.register_handler(myquit, [QUIT])
    pge.register_handler(key_pressed, [KEYDOWN])
    pge.display_set_mode([800, 800])
    pge.draw_collision(False, False)
    pge.record()
    placeBox([0.4, 0.3], 0.1, red).fix()
    placeBoarders(boarder, wood_dark)
    placeBox([0.47, 0.7], 0.1, blue).mass(1.0)
    # placeBox ([0.35, 0.7], 0.1, green).mass (1.0)
    # placeBall ([0.25, 0.85], 0.03, green).mass (1.0)
    pge.gravity()
    pge.run(1.65)
    pge.finish_record()
Example #16
0
def main():
    global gb, sides, springs

    spring_power = 1000.0
    damping = 7.0
    snap_length = 1.0

    placeBoarders(0.01, wood_dark)
    placeRamps()
    placeSilos()
    #  placeTriangle ([0.2, 0.3+0.3], [0.4, 0.3+0.3], [0.3, 0.4+0.3], white)
    displayTriangle()
    timer()

    left = placeBall(wood_light, 0.05, 0.45, 0.03).fix()
    right = placeBall(wood_light, 0.95, 0.45, 0.03).fix()
    box_of(boarder, [0.1, 0.08], 0.2, wood_light)

    prev = left
    springs = []
    for x in range(5, 95,
                   20):  #3rd value in the parameter deals with interation
        # pge.at_time (2.0, drop_gb)
        step = placeBall(wood_dark, float(x) / 100.0, 0.33, 0.03).mass(0.9)
        s = pge.spring(prev, step, spring_power, damping,
                       0.1).draw(yellow, 0.002)
        s.when(snap_length, snap_it)
        springs += [s]
        prev = step

    s = pge.spring(right, prev, spring_power, damping, 0.1).draw(yellow, 0.002)
    s.when(snap_length, snap_it)
    #pge.at_time (2.0, drop_gb)
    drop_gb(10, None)
    print("before run")
    pge.record()
    pge.draw_collision(True, False)
    pge.collision_colour(blue)
    pge.gravity()
    pge.dump_world()
    pge.slow_down(2.5)  # slows down real time by a factor of
    pge.register_handler(myquit, [QUIT])
    pge.register_handler(key_pressed, [KEYDOWN])
    pge.display_set_mode([600, 1000])
    pge.local_fps()
    pge.run(10.0)
    pge.finish_record()
Example #17
0
def main():
    global gb, sb, sides

    placeBoarders(0.01, wood_dark)

    sb = placeBall(wood_light, 0.25, 0.85, 0.02).mass(0.1)
    gb = placeBall(steel, 0.4, 0.9, 0.01).mass(1.0)
    print("before run")
    pge.record()
    pge.draw_collision(True, False)
    pge.collision_colour(red)
    pge.gravity()
    pge.dump_world()
    pge.slow_down(6.0)  # slows down real time by a factor of
    pge.register_handler(myquit, [QUIT])
    pge.register_handler(key_pressed, [KEYDOWN])
    pge.display_set_mode([1000, 1000])
    pge.run(10.0)
    pge.finish_record()
Example #18
0
def main():
    global gb, winner, loser, seconds_left

    b1, b2, b3, b4 = placeBoarders(boarder, wood_dark)
    g1 = placeBall(gold, 0.19, 0.8, 0.05).mass(1.25)
    for i in range(1, 4):
        g3 = placeBall(gold, 0.59, 0.8 - (float(i) * 1.01 / 10.0),
                       0.05).mass(1.25)

    print "before run"
    pge.gravity()
    pge.dump_world()
    pge.draw_collision(True, False)
    pge.slow_down(slowdown)  # slows down real time by a factor of
    pge.display_set_mode([800, 800])
    # pge.display_fullscreen (True)
    seconds_left = 10 * slowdown
    pge.run(10.0)
    pge.finish_record()
Example #19
0
def main ():
    
    master = Tk()
  
    master.title("PGE-Sandbox")
    print "About to run window"
    app = wind1(master)
    master.mainloop()
   





    b1, b2, b3, b4 = placeBoarders (boarder, wood_light)
    print "before run"
    pge.gravity ()
    pge.dump_world ()
    pge.run (config.Time)
    pge.finish ()
Example #20
0
def main():
    global gb, sides

    placeBoarders(0.01, wood_dark)

    first = placeBall(wood_light, 0.55, 0.95, 0.03).fix()
    second = placeBall(wood_dark, 0.55, 0.35, 0.03).mass(1.0)
    s = pge.spring(first, second, 100.0, 0.5).draw(yellow, 0.002)
    print("before run")
    pge.record()
    pge.draw_collision(True, False)
    pge.collision_colour(red)
    pge.gravity()
    pge.dump_world()
    pge.slow_down(6.0)  # slows down real time by a factor of
    pge.register_handler(myquit, [QUIT])
    pge.register_handler(key_pressed, [KEYDOWN])
    pge.display_set_mode([800, 800])
    pge.run(10.0)
    pge.finish_record()
Example #21
0
def main():
    global gb, sides, connection

    placeBoarders(0.01, wood_dark)

    connection = placeBall(wood_light, 0.75, 0.45, 0.01).fix()

    print("before run")
    pge.record()
    pge.draw_collision(True, False)
    pge.collision_colour(red)
    pge.gravity()
    pge.dump_world()
    pge.slow_down(6.0)  # slows down real time by a factor of
    pge.register_handler(myquit, [QUIT])
    pge.register_handler(key_pressed, [KEYDOWN])
    pge.register_handler(mouse_clicked, [MOUSEBUTTONDOWN])
    pge.display_set_mode([1000, 1000])
    pge.local_fps()
    pge.run(10.0)
    pge.finish_record()
Example #22
0
def main():
    sb = placeBall(steel, 0.57, 0.8, 0.05).mass(1).on_collision(play_crack)
    cb = placeBall(copper, 0.81, 0.8, 0.05).mass(.75).on_collision(play_bounce)
    gb = placeBall(gold, 0.19, 0.7, 0.05).mass(1.25).on_collision(play_bounce)

    f = placeBall(wood_light, 0.95, 0.05, 0.1).fix()
    # l = placeBox ([0.3, 0.3], [0.3, 0.5], [0.5, 0.5], [0.5, 0.3], white)
    t1 = placeTriangle([0.2, 0.3], [0.4, 0.3], [0.3, 0.4], white)
    t2 = placeTriangle([0.6, 0.3], [0.8, 0.3], [0.7, 0.4], white)
    placeRamps()
    b1, b2, b3, b4 = placeBoarders(boarder, wood_dark)
    for b in [b1, b2, b3, b4]:
        b.on_collision(play_crack)
    box_of(boarder, [0.0, 0.8], 0.2, wood_dark)
    placeSilos()

    print "before run"
    pge.gravity()
    pge.dump_world()
    pge.run(18.0)
    pge.finish()
Example #23
0
def main():
    global gb, sides

    spring_power = 100.0
    damping = 1.0

    placeBoarders(0.01, wood_dark)

    top_left = placeBall(wood_light, 0.25, 0.85, 0.02).mass(0.1)
    top_right = placeBall(wood_light, 0.45, 0.80, 0.02).mass(0.1)
    bot_left = placeBall(wood_light, 0.25, 0.65, 0.02).mass(0.1)
    bot_right = placeBall(wood_light, 0.45, 0.60, 0.02).mass(0.1)
    s0 = pge.spring(top_left, top_right, spring_power,
                    damping).draw(yellow, 0.002)
    s1 = pge.spring(top_right, bot_right, spring_power,
                    damping).draw(yellow, 0.002)
    s2 = pge.spring(bot_right, bot_left, spring_power,
                    damping).draw(yellow, 0.002)
    s3 = pge.spring(bot_left, top_left, spring_power,
                    damping).draw(yellow, 0.002)
    s4 = pge.spring(top_left, bot_right, spring_power,
                    damping).draw(yellow, 0.002)
    s5 = pge.spring(bot_left, top_right, spring_power,
                    damping).draw(yellow, 0.002)

    for i in range(2, 7):
        gb1 = placeBall(steel, float(i) / 10.0, 0.9, 0.01).mass(1.0)
    gb1 = placeBall(steel, 0.4, 0.9, 0.01).mass(1.0)
    print("before run")
    pge.record()
    pge.draw_collision(True, False)
    pge.collision_colour(red)
    pge.gravity()
    pge.dump_world()
    pge.slow_down(6.0)  # slows down real time by a factor of
    pge.register_handler(myquit, [QUIT])
    pge.register_handler(key_pressed, [KEYDOWN])
    pge.display_set_mode([1000, 1000])
    pge.run(10.0)
    pge.finish_record()
Example #24
0
def main():
    global gb, sides, springs

    spring_power = 1000.0
    damping = 10.0
    snap_length = 0.16

    placeBoarders(0.01, wood_dark)

    left = placeBall(wood_light, 0.25, 0.45, 0.03).fix()
    right = placeBall(wood_light, 0.75, 0.45, 0.03).fix()

    prev = left
    springs = []
    for x in range(35, 75, 10):
        step = placeBall(wood_dark, float(x) / 100.0, 0.33, 0.03).mass(0.9)
        s = pge.spring(prev, step, spring_power, damping,
                       0.1).draw(yellow, 0.002)
        s.when(snap_length, snap_it)
        springs += [s]
        prev = step

    s = pge.spring(right, prev, spring_power, damping, 0.1).draw(yellow, 0.002)
    s.when(snap_length, snap_it)
    pge.at_time(0.6, drop_gb)
    drop_gb(None, None)
    print "before run"
    pge.record()
    pge.draw_collision(False, False)
    pge.collision_colour(red)
    pge.gravity()
    pge.dump_world()
    pge.slow_down(6.0)  # slows down real time by a factor of
    pge.register_handler(myquit, [QUIT])
    pge.register_handler(key_pressed, [KEYDOWN])
    pge.display_set_mode([1000, 1000])
    local_fps()
    pge.run(10.0)
    pge.finish_record()
Example #25
0
def main ():
    global gb, sides, winner, loser, seconds_left, slowdown, simulatedtime

    t1 = placeTriangle ([0.2, 0.3], [0.4, 0.3], [0.3, 0.4], white)
    t2 = placeTriangle ([0.6, 0.3], [0.8, 0.3], [0.7, 0.4], white)
    b1, b2, b3, b4 = placeBoarders (boarder, wood_dark)
    b1.on_collision (delete_ball)

    gb = placeBall (green, 0.19, 0.8, 0.05).mass (1.25).on_collision_with (sides, delete_it)

    print("before run")
    pge.draw_collision (True, False)
    pge.slow_down (slowdown)  # slows down real time by a factor of
    pge.register_handler (myquit, [QUIT])
    pge.register_handler (key_pressed, [KEYDOWN])
    pge.register_handler (mouse_hit, [MOUSEBUTTONDOWN])
    pge.display_set_mode ([800, 800])
    seconds_left = simulatedtime * slowdown
    pge.gravity ()
    pge.run (simulatedtime)
    pge.run (4.0)
    pge.finish_record ()
Example #26
0
def main():
    global g, blue, steel, slowdown, seconds_left

    print "about to create white text"
    t1 = placeTriangle([0.2, 0.4], [0.4, 0.4], [0.3, 0.5], white)
    t2 = placeTriangle([0.6, 0.4], [0.8, 0.4], [0.7, 0.5], white)

    r = placeBall(copper, 0.5, 0.7, 0.07).fix().on_collision(boost)
    placeBall(steel, 0.95, 0.95, 0.01).fix()
    for b in range(4):
        placeBall(steel, b * 2 / 10.0 + 0.1, 0.25, 0.01).fix()
    placeSilos()
    print "completed white text"
    n, e, s, w = placeBoarders(boarder, wood_dark)
    s.on_collision(delete_ball)
    placeShoot()

    print "before run"
    pge.gravity()
    pge.dump_world()
    pge.draw_collision(True, False)
    # pge.collision_colour (green)
    pge.slow_down(6.0)  # slows down real time by a factor of
    pge.fps(200)
    pge.display_set_mode([800, 800])
    pge.register_handler(key_pressed, [KEYDOWN])
    pge.register_handler(mouse_press, [MOUSEBUTTONDOWN])
    pge.register_handler(myquit, [QUIT])

    seconds_left = simulatedtime * slowdown
    timer()
    pge.run(simulatedtime)
    if not winner:
        loser = True
        pge.text(0.2, 0.3, "Loser", white, 100, 1)
        pge.at_time(4.0, finish_game)
    pge.run(4.0)
    pge.finish_record()
Example #27
0
def main():
    global g
    # s = placeBall (steel, 0.54, 0.8, 0.05).mass (1).on_collision (play_crack)
    # c = placeBall (copper, 0.85, 0.8, 0.05).mass (.75).on_collision (play_bounce)
    g = placeBall(gold, 0.15, 0.8, 0.05).mass(1.25).on_collision(play_bounce)
    f = placeBall(red, 0.95, 0.05, 0.1).fix()
    l = placeBox([0.3, 0.3], [0.3, 0.5], [0.5, 0.5], [0.5, 0.3])
    b1, b2, b3, b4 = placeBoarders(boarder, wood_dark)
    for b in [b1, b2, b3, b4]:
        b.on_collision(play_crack)

    print "before run"
    pge.gravity()
    pge.dump_world()
    pge.draw_collision(True, False)
    pge.collision_colour(green)
    pge.slow_down(6.0)  # slows down real time by a factor of
    pge.display_set_mode([640, 640])
    pge.register_handler(key_pressed, [KEYDOWN])
    pge.register_handler(mouse_hit, [MOUSEBUTTONDOWN])
    pge.register_handler(myquit, [QUIT])
    pge.run(30.0)
    pge.finish()
Example #28
0
def main():
    global gb, sb, sides

    placeBoarders(0.01, wood_dark)

    spring_power = 100.0
    damping = 1.0

    sbl = placeBall(wood_light, 0.35, 0.85, 0.02).mass(1)
    sbr = placeBall(wood_light, 0.65, 0.85, 0.02).mass(1)
    s = pge.spring(sbl, sbr, spring_power, damping).draw(yellow, 0.002)
    gb = placeBall(steel, 0.8, 0.85, 0.02).mass(1.0)
    print "before run"
    pge.record()
    pge.draw_collision(True, False)
    pge.collision_colour(red)
    pge.gravity()
    pge.dump_world()
    pge.slow_down(6.0)  # slows down real time by a factor of
    pge.register_handler(myquit, [QUIT])
    pge.register_handler(key_pressed, [KEYDOWN])
    pge.display_set_mode([1000, 1000])
    pge.run(10.0)
    pge.finish_record()
Example #29
0
def main():
    global gb, winner, loser, seconds_left

    b1, b2, b3, b4 = placeBoarders(boarder, wood_dark)
    g1 = placeBall(gold, 0.19, 0.8, 0.05).mass(1.25)
    g2 = placeBall(gold, 0.59, 0.8, 0.05).mass(1.25)
    g3 = placeBall(gold, 0.7, 0.8, 0.05).mass(1.25)
    g4 = placeBall(gold, 0.81, 0.8, 0.05).mass(1.25)
    g5 = placeBall(gold, 0.92, 0.8, 0.05).mass(1.25)
    g6 = placeBall(gold, 0.92, 0.69, 0.05).mass(1.25)

    pge.register_handler(myquit, [QUIT])
    pge.register_handler(key_pressed, [KEYDOWN])

    print "before run"
    pge.gravity()
    pge.dump_world()
    pge.draw_collision(True, False)
    pge.slow_down(slowdown)  # slows down real time by a factor of
    pge.display_set_mode([800, 800])
    # pge.display_fullscreen (True)
    seconds_left = 10 * slowdown
    pge.run(10.0)
    pge.finish_record()
Example #30
0
def main():
    global gb, sides

    a = placeBall(blue_dark, 0.07, 0.95, 0.015).fix()
    for e in range(8):
        b = placeBall(blue_dark, 0.08, 0.90 - float(e) / 30.0, 0.015).mass(1.0)
        s = pge.spring(a, b, 1000, 20).draw(yellow, 0.002)
        a = b

    f = placeBall(wood_light, 0.95, 0.05, 0.1).fix()
    t1 = placeTriangle([0.2, 0.3], [0.4, 0.3], [0.3, 0.4], white)
    t2 = placeTriangle([0.6, 0.3], [0.8, 0.3], [0.7, 0.4], white)
    placeRamps()
    b1, b2, b3, b4 = placeBoarders(boarder, wood_dark)
    for b in [b1, b2, b3, b4]:
        b.on_collision(play_crack)
    box_of(boarder, [0.1, 0.08], 0.2, wood_light)
    gb = placeBall(gold, 0.19, 0.7,
                   0.025).mass(1.25).on_collision_with(sides, delete_it)
    sb = placeBall(steel, 0.57, 0.8,
                   0.025).mass(1).on_collision_with(sides, delete_it)
    cb = placeBall(copper, 0.81, 0.8,
                   0.025).mass(.75).on_collision_with(sides, delete_it)
    placeSilos()

    print "before run"
    pge.gravity()
    pge.dump_world()
    pge.draw_collision(True, False)
    pge.slow_down(6.0)  # slows down real time by a factor of
    pge.register_handler(myquit, [QUIT])
    pge.register_handler(key_pressed, [KEYDOWN])
    pge.register_handler(mouse_hit, [MOUSEBUTTONDOWN])
    pge.display_set_mode([1000, 1000])
    pge.run(18.0)
    pge.finish_record()