Пример #1
0
Файл: main.py Проект: msarch/py
def populate():
    # define zulus
    for i in range(1, 2000):
        x = random.uniform(1, 1280)
        y = random.uniform(1, 800)
        shp = Rect(20, 20)
        pos = [x, y, 0.0]
        r = random.uniform(0, 1.0)
        g = random.uniform(0, 1.0)
        b = random.uniform(0, 1.0)
        a = random.uniform(0, 1.0)
        col = [r, g, b, a]
        z = Zulu(shp, pos, col)

        #Define as many rules as necessary
        vx = random.uniform(-120, 120)
        vy = random.uniform(-80, 80)
        r1 = Slide(vx, vy)

        # append zulus to rules
        r1.add(z)
    for i in range(1, 100):
        x = random.uniform(1, 1200)
        y = random.uniform(1, 800)
        shp = Rect(20, 20)
        pos = [x, y, 0.0]
        r = random.uniform(0, 1.0)
        g = random.uniform(0, 1.0)
        b = random.uniform(0, 1.0)
        a = random.uniform(0, 1.0)
        col = [r, g, b, a]
        z = Zulu(shp, pos, col)
Пример #2
0
Файл: main.py Проект: msarch/py
def populate():
    # define zulus
    for i in range (1,2000):
        x=random.uniform(1,1280)
        y=random.uniform(1,800)
        shp=Rect(20,20)
        pos=[x,y,0.0]
        r=random.uniform(0,1.0)
        g=random.uniform(0,1.0)
        b=random.uniform(0,1.0)
        a=random.uniform(0,1.0)
        col=[r,g,b,a]
        z= Zulu(shp,pos,col)

    #Define as many rules as necessary
        vx=random.uniform(-120,120)
        vy=random.uniform(-80,80)
        r1=Slide(vx,vy)

    # append zulus to rules
        r1.add(z)
    for i in range (1,100):
        x=random.uniform(1,1200)
        y=random.uniform(1,800)
        shp=Rect(20,20)
        pos=[x,y,0.0]
        r=random.uniform(0,1.0)
        g=random.uniform(0,1.0)
        b=random.uniform(0,1.0)
        a=random.uniform(0,1.0)
        col=[r,g,b,a]
        z= Zulu(shp,pos,col)
Пример #3
0
Файл: main.py Проект: msarch/py
def populate():
    # define zulus
    for i in range (1,160):
        x=random.uniform(1,1280)
        y=random.uniform(1,800)
        shp=Rect(2,2)
        pos=[x,y,0.0]
        a=0 # angle
        r=random.uniform(0,1.0)
        g=random.uniform(0,1.0)
        b=random.uniform(0,1.0)
        a=random.uniform(0,1.0)
        col=[r,g,b,a]
        z= Zulu(shp,pos,a,col)

    #Define as many rules as necessary
        r1=Slide((random.uniform(-120,120),random.uniform(-80,80)))

    # append zulus to rules
        r1.add(z)
    for i in range (1,160):
        x=random.uniform(1,1200)
        y=random.uniform(1,800)
        shp=Rect(20,20)
        pos=[x,y,0.0]
        a=0 # angle
        r=random.uniform(0,1.0)
        g=random.uniform(0,1.0)
        b=random.uniform(0,1.0)
        a=random.uniform(0,1.0)
        col=[r,g,b,a]
        z= Zulu(shp,pos,a,col)
Пример #4
0
def populate():
    # define zulus
    for i in range(1, 160):
        x = random.uniform(1, 1280)
        y = random.uniform(1, 800)
        shp = Rect(2, 2)
        pos = [x, y, 0.0]
        a = 0  # angle
        r = random.uniform(0, 1.0)
        g = random.uniform(0, 1.0)
        b = random.uniform(0, 1.0)
        a = random.uniform(0, 1.0)
        col = [r, g, b, a]
        z = Zulu(shp, pos, a, col)

        #Define as many rules as necessary
        r1 = Slide((random.uniform(-120, 120), random.uniform(-80, 80)))

        # append zulus to rules
        r1.add(z)
    for i in range(1, 160):
        x = random.uniform(1, 1200)
        y = random.uniform(1, 800)
        shp = Rect(20, 20)
        pos = [x, y, 0.0]
        a = 0  # angle
        r = random.uniform(0, 1.0)
        g = random.uniform(0, 1.0)
        b = random.uniform(0, 1.0)
        a = random.uniform(0, 1.0)
        col = [r, g, b, a]
        z = Zulu(shp, pos, a, col)
Пример #5
0
Файл: main.py Проект: msarch/py
def populate():
    # define zulus
    z1 = Zulu()
    z1.shape=Rect(100,100)
    z1.centroid=[0,0,0]
    z1.color=[123,3,212]
    # Define as many rules as necessary, append zulus to rules
    r1=Slide(27,0)
    r1.apply_to(z1)
    r2=Bounce(land.boundaries)
    r2.apply_to(z1)
Пример #6
0
def populate():
    # define zulus
    z1 = Zulu()
    z1.shape = Rect(100, 100)
    z1.centroid = [0, 0, 0]
    z1.color = [123, 3, 212]
    # Define as many rules as necessary, append zulus to rules
    r1 = Slide(27, 0)
    r1.apply_to(z1)
    r2 = Bounce(land.boundaries)
    r2.apply_to(z1)
Пример #7
0
Файл: main.py Проект: msarch/py
def definitions():
#    # define zulus
    #for i in range (1,160):
        #x=random.uniform(1,1280)
        #y=random.uniform(1,800)
        #body=Rect(20,20)
        #anchor=[x,y,0.0]
        #angle=0 # angle
        #r=random.uniform(0,1.0)
        #g=random.uniform(0,1.0)
        #b=random.uniform(0,1.0)
        #a=random.uniform(0,1.0)
        #color=[r,g,b,a]
        #z= Zulu(body,anchor,angle,color)

    ##Define as many rules as necessary
        #r1=Slide((random.uniform(-120,120),random.uniform(-80,80)))

    ## append zulus to rules
        #r1.add(z)
    #for i in range (1,160):
        #x=random.uniform(1,1200)
        #y=random.uniform(1,800)
        #shp=Rect(20,20)
        #pos=[x,y,0.0]
        #a=0 # angle
        #r=random.uniform(0,1.0)
        #g=random.uniform(0,1.0)
        #b=random.uniform(0,1.0)
        #a=random.uniform(0,1.0)
        #col=[r,g,b,a]
        #z= Zulu(shp,pos,a,col)


    egg_white = [
        -10, -25,
        -20, -15,
        +10, -25,
        -20, +15,
        +20, -15,
        -10, +25,
        +20, +15,
        +10, +25,
    ]
    egg_yellow = [
        -10, -10,
        -10, +10,
        +10, -10,
        +10, +10,
    ]
    sh = Body([
        Prim(egg_white, Color.white).offset(+200, +105),
        Prim(egg_yellow, Color.orange).offset(+300, +200),
        Rect(100,100,120,200, Color.red).offset(100,200),
        Rect(100,100,120,200, Color.red).rotate(10).offset(200,600)
    ])
    toto= Zulu(body=sh)
    rule1=Slide((random.uniform(-12,12),random.uniform(-8,8)))
    engine.ruleset.add(rule1,toto)
Пример #8
0
Файл: main.py Проект: msarch/py
def populate():
    # define zulus

    for i in range (1,2000):
        print i
        z= Zulu()
        x=random.randint(1,1200)
        y=random.randint(1,800)

        z.shape=Rect(20,20)
        z.position=[x,y]

        vx=random.randint(-120,120)
        vy=random.randint(-80,80)

    #Define as many rules as necessary
        r1=Slide(vx,vy)
    # append zulus to rules
        r1.add(z)
Пример #9
0
def populate():
    # define zulus

    for i in range(1, 2000):
        print i
        z = Zulu()
        x = random.randint(1, 1200)
        y = random.randint(1, 800)

        z.shape = Rect(20, 20)
        z.position = [x, y]

        vx = random.randint(-120, 120)
        vy = random.randint(-80, 80)

        #Define as many rules as necessary
        r1 = Slide(vx, vy)
        # append zulus to rules
        r1.add(z)
Пример #10
0
Файл: bbw.py Проект: msarch/py
show(k1, k2, k3, k4, k5, k6, k7, k8, s1, s2)

#star=Composite(k1,k2,k3,k4,k5,k6,k7,k8,s1,s2)
#mickey=Composite(k1,k2,k3,k4,k5,k6,k7,k8, peg=Peg(100,-100,45))
#show(star)
#show(mickey)

#--- COLLECT ------------------------------------------------------------------
'''
shapes are added to GROUPS i.e. an ordered? list of stuff
and any attributes can be added to groups as well as shapes
'''
s1.vel = Vel(W, 0, 0)
s2.vel = Vel(0, V, 0)
#Actor('c2', cshapes='pac', peg=dk)  # possibly give either 2 or 3 coord or peg TODO

#--- RULES --------------------------------------------------------------------
'''
ordrered list of rules.
syntax : Rule(rule name, Actor(s)=target shape(s), named rule args=value)
'''
sl = Slide(s1, s2)
bnc = Bounce(s1, s2,
             rect=SCREEN)  # add broadcast = True                   TODO
#Cycle_Color(s1, s2, color_list=kapla_colors, period=2)
bnc.start()
sl.start()
# voir décorateurs pour conditional rules et broadcast rules                    TODO

#------------------------------------------------------------------------------
Пример #11
0
Файл: bbw.py Проект: msarch/py
'''
Actor('b1', shape='b1')

Actor('k1', shape='k1')
Actor('k2', shape='k2')
Actor('k3', shape='k3')
Actor('k4', shape='k4')
Actor('k5', shape='k5')
Actor('k6', shape='k6')
Actor('k7', shape='k7')
Actor('k8', shape='k8')

Actor('s1', shape='s1', vel=Vel(V, 0, 0))
Actor('s2', shape='s2', vel=Vel(0, V, 0))
#Actor('c2', cshapes='pac', peg=dk)  # possibly give either 2 or 3 coord or peg TODO

#--- RULES --------------------------------------------------------------------
'''
ordrered list of rules.
syntax : Rule(rule name, Actor(s)=target shape(s), named rule args=value)
'''
Slide('slide_h', actors=('s2', ))
Slide('slide_v', actors=('s1', ))
Bounce('screen_bounce', actors=('s1', 's2'),
       rect=SCREEN)  # broadcast = True   TODO
Cycle_Color('cycle', actors=('s1', 's2'), color_list=kapla_colors, period=2)

# voir décorateurs pour conditional rules et broadcast rules

#------------------------------------------------------------------------------
Пример #12
0
Файл: bbw.py Проект: msarch/py
show(k1,k2,k3,k4,k5,k6,k7,k8,s1,s2)

#star=Composite(k1,k2,k3,k4,k5,k6,k7,k8,s1,s2)
#mickey=Composite(k1,k2,k3,k4,k5,k6,k7,k8, peg=Peg(100,-100,45))
#show(star)
#show(mickey)

#--- COLLECT ------------------------------------------------------------------
'''
shapes are added to GROUPS i.e. an ordered? list of stuff
and any attributes can be added to groups as well as shapes
'''
s1.vel=Vel(W,0,0)
s2.vel=Vel(0,V,0)
#Actor('c2', cshapes='pac', peg=dk)  # possibly give either 2 or 3 coord or peg TODO


#--- RULES --------------------------------------------------------------------
'''
ordrered list of rules.
syntax : Rule(rule name, Actor(s)=target shape(s), named rule args=value)
'''
sl=Slide(s1, s2)
bnc=Bounce(s1, s2, rect=SCREEN)  # add broadcast = True                   TODO
#Cycle_Color(s1, s2, color_list=kapla_colors, period=2)
bnc.start()
sl.start()
# voir décorateurs pour conditional rules et broadcast rules                    TODO

#------------------------------------------------------------------------------