Ejemplo n.º 1
0
def placeRamps():
    global springs
    r1 = pge.poly4(0.3, 0.8, 0.85, 0.82, 0.85, 0.83, 0.3, 0.81,
                   wood_dark).fix()

    r2 = pge.poly4(0.3, 0.4, 0.85, 0.42, 0.85, 0.43, 0.3, 0.41,
                   wood_dark).fix()

    r3 = pge.poly4(0.15, 0.6, 0.32, 0.58, 0.32, 0.57, 0.15, 0.59,
                   wood_dark).fix()

    p1 = pge.circle(0.32, 0.57, 0.01, wood_dark).fix()
    p2 = pge.circle(0.60, 0.55, 0.01, wood_dark).fix()
    spring_power = 10.0
    damping = 1.0
    break_length = 0.2

    springs = []
    prev = p1
    for x in range(37, 55, 5):
        step = placeBall(wood_dark, float(x) / 100.0, 0.56, 0.01).mass(0.01)
        s = pge.spring(prev, step, spring_power, damping,
                       0.02).draw(yellow, 0.002)
        s.when(break_length, snap_it)
        prev = step
        springs += [s]
    s = pge.spring(p2, prev, spring_power, damping, 0.02).draw(yellow, 0.002)
    s.when(break_length, snap_it)
    springs += [s]
Ejemplo n.º 2
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)
Ejemplo n.º 3
0
def fire_bubble ():
    global currentCircle, currentColour
    if currentCircle == None:
        currentColour = red
        currentCircle = pge.circle (0.5, 0.1, 0.03, currentColour)
        currentCircle.mass (1.0)
        currentCircle.put_yvel (8.0)
Ejemplo n.º 4
0
def fire (e, colour):
    global currentColour, currentCircle
    mouse = pge.pyg_to_unit_coord (e.pos)
    currentColour = colour
    currentCircle = pge.circle (0.5, 0.21, 0.03, currentColour).mass (1.0)
    currentCircle.put_yvel (7*mouse[1])
    currentCircle.put_xvel ((0.5-mouse[0])*-6.0)
Ejemplo n.º 5
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 ()
Ejemplo n.º 6
0
def placeBall (kind, x, y, r):
    return pge.circle (x, y, r, kind)
Ejemplo n.º 7
0
def placeBall (x, y, r):
    return pge.circle (x, y, r, metal)
Ejemplo n.º 8
0
def placeBall(p, r, c):
    return pge.circle(p[0], p[1], r, c)