Beispiel #1
0
def setup():
    global world

    size(400, 400)
    smooth()
    Fisica.init(this)
    world = FWorld()
    world.setGravity(0, -300)
    l = FPoly()
    l.vertex(width/2-hole/2, 0)
    l.vertex(0, 0)
    l.vertex(0, height)
    l.vertex(0+sideMargin, height)
    l.vertex(0+sideMargin, height-bottomMargin)
    l.vertex(width/2-hole/2, topMargin)
    l.setStatic(True)
    l.setFill(0)
    l.setFriction(0)
    world.add(l)
    r = FPoly()
    r.vertex(width/2+hole/2, 0)
    r.vertex(width, 0)
    r.vertex(width, height)
    r.vertex(width-sideMargin, height)
    r.vertex(width-sideMargin, height-bottomMargin)
    r.vertex(width/2+hole/2, topMargin)
    r.setStatic(True)
    r.setFill(0)
    r.setFriction(0)
    world.add(r)
Beispiel #2
0
def setup():
    global world

    size(400, 400)
    smooth()
    Fisica.init(this)
    world = FWorld()
    world.setGravity(0, -300)
    l = FPoly()
    l.vertex(width / 2 - hole / 2, 0)
    l.vertex(0, 0)
    l.vertex(0, height)
    l.vertex(0 + sideMargin, height)
    l.vertex(0 + sideMargin, height - bottomMargin)
    l.vertex(width / 2 - hole / 2, topMargin)
    l.setStatic(True)
    l.setFill(0)
    l.setFriction(0)
    world.add(l)
    r = FPoly()
    r.vertex(width / 2 + hole / 2, 0)
    r.vertex(width, 0)
    r.vertex(width, height)
    r.vertex(width - sideMargin, height)
    r.vertex(width - sideMargin, height - bottomMargin)
    r.vertex(width / 2 + hole / 2, topMargin)
    r.setStatic(True)
    r.setFill(0)
    r.setFriction(0)
    world.add(r)
Beispiel #3
0
def mousePressed():
    if world.getBody(mouseX, mouseY):
        return
    global poly
    poly = FPoly()
    poly.setStrokeWeight(3)
    poly.setFill(120, 30, 90)
    poly.setDensity(10)
    poly.setRestitution(0.5)
    poly.vertex(mouseX, mouseY)
def mousePressed():
    if world.getBody(mouseX, mouseY):
        return
    global poly
    poly = FPoly()
    poly.setStrokeWeight(3)
    poly.setFill(120, 30, 90)
    poly.setDensity(10)
    poly.setRestitution(0.5)
    poly.vertex(mouseX, mouseY)