Ejemplo n.º 1
0
def setup():
    global world
    size(400, 400)
    smooth()
    Fisica.init(this)
    world = FWorld()
    world.setGravity(0, 0)
    world.setEdges()
    world.remove(world.left)
    world.remove(world.top)
    world.remove(world.bottom)
    for i in range(ballCount):
        b = FCircle(25)
        b.setPosition(40, map(i, 0, ballCount - 1, 40, height - 40))
        b.setDensity(map(i, 0, ballCount - 1, 0.1, 0.9))
        b.setVelocity(100, 0)
        b.setDamping(0.0)
        b.setNoStroke()
        b.setFill(map(i, 0, ballCount - 1, 120, 0))
        world.add(b)
    for i in range(ballCount):
        b = FCircle(25)
        b.setPosition(width / 2, map(i, 0, ballCount - 1, 40, height - 40))
        b.setVelocity(0, 0)
        b.setDamping(0.0)
        b.setDensity(0.9)
        b.setNoStroke()
        b.setFill(125, 80, 120)
        world.add(b)
Ejemplo n.º 2
0
def setup():
    global world
    size(400, 400)
    smooth()
    Fisica.init(this)
    world = FWorld()
    world.setGravity(0, 0)
    world.setEdges()
    world.remove(world.left)
    world.remove(world.top)
    world.remove(world.bottom)
    for i in range(ballCount):
        b = FCircle(25)
        b.setPosition(40, map(i, 0, ballCount-1, 40, height-40))
        b.setDensity(map(i, 0, ballCount-1, 0.1, 0.9))
        b.setVelocity(100, 0)
        b.setDamping(0.0)
        b.setNoStroke()
        b.setFill(map(i, 0, ballCount-1, 120, 0))
        world.add(b)
    for i in range(ballCount):
        b = FCircle(25)
        b.setPosition(width/2, map(i, 0, ballCount-1, 40, height-40))
        b.setVelocity(0, 0)
        b.setDamping(0.0)
        b.setDensity(0.9)
        b.setNoStroke()
        b.setFill(125, 80, 120)
        world.add(b)
Ejemplo n.º 3
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)
Ejemplo n.º 4
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)
Ejemplo n.º 5
0
def setup():
    global boxButton, circleButton, polyButton, world

    size(400, 400)
    smooth()
    Fisica.init(this)
    world = FWorld()
    world.setEdges()
    world.remove(world.left)
    world.remove(world.right)
    world.remove(world.top)
    boxButton = FBox(40, 40)
    boxButton.setPosition(width/4, 100)
    boxButton.setStatic(True)
    boxButton.setFillColor(buttonColor)
    boxButton.setNoStroke()
    world.add(boxButton)
    circleButton = FCircle(40)
    circleButton.setPosition(2*width/4, 100)
    circleButton.setStatic(True)
    circleButton.setFillColor(buttonColor)
    circleButton.setNoStroke()
    world.add(circleButton)
    polyButton = FPoly()
    polyButton.vertex(20, 20)
    polyButton.vertex(-20, 20)
    polyButton.vertex(0, -20)
    polyButton.setPosition(3*width/4, 100)
    polyButton.setStatic(True)
    polyButton.setFillColor(buttonColor)
    polyButton.setNoStroke()
    world.add(polyButton)
Ejemplo n.º 6
0
def setup():
    global world, pop, cage
    size(400, 400)
    smooth()
    Fisica.init(this)
    Fisica.setScale(10)
    world = FWorld()
    world.setEdges()
    world.remove(world.top)
    pop = createPop()
    pop.setPosition(width/2, height/2)
    pop.setBullet(True)
    world.add(pop)
    cage = createCage()
    cage.setPosition(width/2, height/2)
    cage.setRotation(PI/6)
    cage.setBullet(True)
    world.add(cage)

    for _ in range(10):
        c = FCircle(7)
        c.setPosition(width/2-10+random(-5, 5), height/2-10+random(-5, 5))
        c.setBullet(True)
        c.setNoStroke()
        c.setFillColor(color(0xFF, 0x92, 0x03))
        world.add(c)

    rectMode(CENTER)
Ejemplo n.º 7
0
def setup():
    global world, pop, cage
    size(400, 400)
    smooth()
    Fisica.init(this)
    Fisica.setScale(10)
    world = FWorld()
    world.setEdges()
    world.remove(world.top)
    pop = createPop()
    pop.setPosition(width / 2, height / 2)
    pop.setBullet(True)
    world.add(pop)
    cage = createCage()
    cage.setPosition(width / 2, height / 2)
    cage.setRotation(PI / 6)
    cage.setBullet(True)
    world.add(cage)

    for _ in range(10):
        c = FCircle(7)
        c.setPosition(width / 2 - 10 + random(-5, 5),
                      height / 2 - 10 + random(-5, 5))
        c.setBullet(True)
        c.setNoStroke()
        c.setFillColor(color(0xFF, 0x92, 0x03))
        world.add(c)

    rectMode(CENTER)
Ejemplo n.º 8
0
def setup():
    global puenteY, world

    size(400, 400)
    smooth()
    puenteY = height / 3
    Fisica.init(this)
    world = FWorld()
    bola = FCircle(40)
    bola.setPosition(width / 3, puenteY - 10)
    bola.setDensity(0.2)
    bola.setFill(120, 120, 190)
    bola.setNoStroke()
    world.add(bola)
    for i in range(stepCount):
        box = FBox(boxWidth, 10)
        box.setPosition(map(i, 0, stepCount - 1, boxWidth, width - boxWidth),
                        puenteY)
        box.setNoStroke()
        box.setFill(120, 200, 190)
        world.add(box)
        steps.append(box)

    for i in range(1, stepCount):
        junta = FDistanceJoint(steps[i - 1], steps[i])
        junta.setAnchor1(boxWidth / 2, 0)
        junta.setAnchor2(-boxWidth / 2, 0)
        junta.setFrequency(frequency)
        junta.setDamping(damping)
        junta.setFill(0)
        junta.calculateLength()
        world.add(junta)

    left = FCircle(10)
    left.setStatic(True)
    left.setPosition(0, puenteY)
    left.setDrawable(False)
    world.add(left)
    right = FCircle(10)
    right.setStatic(True)
    right.setPosition(width, puenteY)
    right.setDrawable(False)
    world.add(right)
    juntaPrincipio = FDistanceJoint(steps[0], left)
    juntaPrincipio.setAnchor1(-boxWidth / 2, 0)
    juntaPrincipio.setAnchor2(0, 0)
    juntaPrincipio.setFrequency(frequency)
    juntaPrincipio.setDamping(damping)
    juntaPrincipio.calculateLength()
    juntaPrincipio.setFill(0)
    world.add(juntaPrincipio)
    juntaFinal = FDistanceJoint(steps[stepCount - 1], right)
    juntaFinal.setAnchor1(boxWidth / 2, 0)
    juntaFinal.setAnchor2(0, 0)
    juntaFinal.setFrequency(frequency)
    juntaFinal.setDamping(damping)
    juntaFinal.calculateLength()
    juntaFinal.setFill(0)
    world.add(juntaFinal)
Ejemplo n.º 9
0
def setup():
    global world
    size(400, 400)
    smooth()
    Fisica.init(this)
    world = FWorld()
    world.setGravity(0, 100)
    world.setEdges()
Ejemplo n.º 10
0
def setup():
    global puenteY, world

    size(400, 400)
    smooth()
    puenteY = height/3
    Fisica.init(this)
    world = FWorld()
    bola = FCircle(40)
    bola.setPosition(width/3, puenteY-10)
    bola.setDensity(0.2)
    bola.setFill(120, 120, 190)
    bola.setNoStroke()
    world.add(bola)
    for i in range(stepCount):
        box = FBox(boxWidth, 10)
        box.setPosition(map(i, 0, stepCount - 1, boxWidth, width-boxWidth), puenteY)
        box.setNoStroke()
        box.setFill(120, 200, 190)
        world.add(box)
        steps.append(box)

    for i in range(1, stepCount):
        junta = FDistanceJoint(steps[i-1], steps[i])
        junta.setAnchor1(boxWidth/2, 0)
        junta.setAnchor2(-boxWidth/2, 0)
        junta.setFrequency(frequency)
        junta.setDamping(damping)
        junta.setFill(0)
        junta.calculateLength()
        world.add(junta)

    left = FCircle(10)
    left.setStatic(True)
    left.setPosition(0, puenteY)
    left.setDrawable(False)
    world.add(left)
    right = FCircle(10)
    right.setStatic(True)
    right.setPosition(width, puenteY)
    right.setDrawable(False)
    world.add(right)
    juntaPrincipio = FDistanceJoint(steps[0], left)
    juntaPrincipio.setAnchor1(-boxWidth/2, 0)
    juntaPrincipio.setAnchor2(0, 0)
    juntaPrincipio.setFrequency(frequency)
    juntaPrincipio.setDamping(damping)
    juntaPrincipio.calculateLength()
    juntaPrincipio.setFill(0)
    world.add(juntaPrincipio)
    juntaFinal = FDistanceJoint(steps[stepCount-1], right)
    juntaFinal.setAnchor1(boxWidth/2, 0)
    juntaFinal.setAnchor2(0, 0)
    juntaFinal.setFrequency(frequency)
    juntaFinal.setDamping(damping)
    juntaFinal.calculateLength()
    juntaFinal.setFill(0)
    world.add(juntaFinal)
Ejemplo n.º 11
0
def setup():
    global world
    size(400, 400)
    smooth()
    Fisica.init(this)
    world = FWorld()
    world.setEdges()
    world.setGravity(0, 0)
    for _ in range(spiderCount):
        createSpider()
Ejemplo n.º 12
0
def setup():
    global world
    size(400, 400)
    smooth()
    Fisica.init(this)
    world = FWorld()
    world.setEdges()
    world.setGravity(0, 0)
    for _ in range(spiderCount):
        createSpider()
Ejemplo n.º 13
0
def setup():
    global mundo
    size(400, 400)
    smooth()

    Fisica.init(this)
    mundo = FWorld()
    mundo.setGravity(0, 200)

    frameRate(24)
    background(0)
Ejemplo n.º 14
0
def setup():
    global mundo
    size(400, 400)
    smooth()

    Fisica.init(this)
    mundo = FWorld()
    mundo.setGravity(0, 200)

    frameRate(24)
    background(0)
Ejemplo n.º 15
0
def setup():
    global world, pala
    size(400, 400)
    smooth()
    Fisica.init(this)
    world = FWorld()
    pala = FBox(50, 20)
    pala.setPosition(width/2, height - 40)
    pala.setStatic(True)
    pala.setFill(0)
    pala.setRestitution(0)
    world.add(pala)
Ejemplo n.º 16
0
def setup():
    global world, pala
    size(400, 400)
    smooth()
    Fisica.init(this)
    world = FWorld()
    pala = FBox(50, 20)
    pala.setPosition(width / 2, height - 40)
    pala.setStatic(True)
    pala.setFill(0)
    pala.setRestitution(0)
    world.add(pala)
Ejemplo n.º 17
0
def setup():
    global world
    size(400, 400)
    smooth()
    Fisica.init(this)
    world = FWorld()
    world.setGravity(0, 800)
    world.setEdges()
    world.remove(world.left)
    world.remove(world.right)
    world.remove(world.top)

    world.setEdgesRestitution(0.5)
Ejemplo n.º 18
0
def setup():
    global world, obstacle
    size(400, 400)
    smooth()
    Fisica.init(this)
    world = FWorld()
    obstacle = FBox(150,150)
    obstacle.setRotation(PI/4)
    obstacle.setPosition(width/2, height/2)
    obstacle.setStatic(True)
    obstacle.setFill(0)
    obstacle.setRestitution(0)
    world.add(obstacle)
Ejemplo n.º 19
0
def setup():
    global world
    size(400, 400)
    smooth()
    Fisica.init(this)
    world = FWorld()
    world.setGravity(0, 800)
    world.setEdges()
    world.remove(world.left)
    world.remove(world.right)
    world.remove(world.top)

    world.setEdgesRestitution(0.5)
Ejemplo n.º 20
0
def setup():
    global world, obstacle
    size(400, 400)
    smooth()
    Fisica.init(this)
    world = FWorld()
    obstacle = FBox(150, 150)
    obstacle.setRotation(PI / 4)
    obstacle.setPosition(width / 2, height / 2)
    obstacle.setStatic(True)
    obstacle.setFill(0)
    obstacle.setRestitution(0)
    world.add(obstacle)
Ejemplo n.º 21
0
def setup():
    global world
    size(400, 400)
    smooth()
    Fisica.init(this)
    world = FWorld()
    world.setEdges()
    world.remove(world.left)
    world.remove(world.right)
    world.remove(world.top)
    world.setEdgesRestitution(0.0)
    for i in range(ballCount):
        b = FCircle(25)
        b.setPosition(map(i, 0, ballCount - 1, 40, width - 40), height / 6)
        b.setRestitution(map(i, 0, ballCount - 1, 0.0, 1.0))
        b.setNoStroke()
        b.setFill(map(i, 0, ballCount - 1, 60, 255), 80, 120)
        world.add(b)
Ejemplo n.º 22
0
def setup():
    global world
    size(400, 400)
    smooth()
    Fisica.init(this)
    world = FWorld()
    world.setEdges()
    world.remove(world.left)
    world.remove(world.right)
    world.remove(world.top)
    world.setEdgesRestitution(0.0)
    for i in range(ballCount):
        b = FCircle(25)
        b.setPosition(map(i, 0, ballCount-1, 40, width-40), height/6)
        b.setRestitution(map(i, 0, ballCount-1, 0.0, 1.0))
        b.setNoStroke()
        b.setFill(map(i, 0, ballCount-1, 60, 255), 80, 120)
        world.add(b)
Ejemplo n.º 23
0
def setup():
    global world

    size(400, 400)
    smooth()
    Fisica.init(this)
    font = loadFont("FreeMonoBold-24.vlw")
    textFont(font, 24)
    world = FWorld()
    world.setEdges(this, color(120))
    world.remove(world.top)
    world.setGravity(0, 500)
    t = Texto("Type and ENTER")
    t.setPosition(width/2, height/2)
    t.setRotation(random(-1, 1))
    t.setFill(255)
    t.setNoStroke()
    t.setRestitution(0.75)
    world.add(t)
Ejemplo n.º 24
0
def setup():
    global world

    size(400, 400)
    smooth()
    Fisica.init(this)
    font = loadFont("FreeMonoBold-24.vlw")
    textFont(font, 24)
    world = FWorld()
    world.setEdges(this, color(120))
    world.remove(world.top)
    world.setGravity(0, 500)
    t = Texto("Type and ENTER")
    t.setPosition(width / 2, height / 2)
    t.setRotation(random(-1, 1))
    t.setFill(255)
    t.setNoStroke()
    t.setRestitution(0.75)
    world.add(t)