Esempio n. 1
0
 def calcDelta(self):
     deltax = deltay = 0
     while deltax == 0:
         deltax = utilities.randint(-20, 20) / 10.0
     while deltay == 0:
         deltay = utilities.randint(-20, 20) / 10.0
     return [deltax, deltay]  # needs to be an array because it changes
Esempio n. 2
0
 def calcDelta(self):
     deltax = deltay = 0
     i = 4  # max step
     while deltax == 0:
         deltax = utilities.randint(-i, i)  #/300.0
     while deltay == 0:
         deltay = utilities.randint(-i, i)  #/300.0
     return [deltax, deltay]  # needs to be an array because it changes
Esempio n. 3
0
 def start(self):
     """ First thing to happen after the instance has been initalisiated
         good place to instanciate classes and init stuff
     """
     for z in range(20):
         y = utilities.randint(0, self.size[0])
         h = utilities.randint(1, 200)
         c = utilities.randRGBA()
         Strippe(y, z, h, c, self.size)
Esempio n. 4
0
 def start(self):
     """ First thing to happen after the instance has been initalisiated
         good place to instanciate classes and init stuff
     """
     for z in range(20):
         y = utilities.randint(0, self.size[0])
         h = utilities.randint(1, 200)
         c = utilities.randRGBA()
         Strippe(y, z, h, c, self.size)
Esempio n. 5
0
 def start(self):
     """ First thing to happen after the instance has been initalisiated
         good place to instanciate classes and init stuff
     """
     self.trails = 1
     for z in range(50):
         x,y = utilities.randPoint(0,0,self.height, self.width)
         s = utilities.choice((GLU_LINE, GLU_FILL, GLU_SILHOUETTE, GLU_POINT))
         Expands(x,y,z, utilities.randint(1,300), utilities.randRGBA(),
                 utilities.randint(1,140), style = s).interactiveState = 2
Esempio n. 6
0
File: orbits2.py Progetto: msarch/py
 def start(self):
     """ First thing to happen after the instance has been initalisiated
         good place to instanciate classes and init stuff
     """
     for z in range(100):
         x = utilities.randint(0, self.width)
         y = utilities.randint(0, self.height)
         h = utilities.randint(2, 20)
         w = utilities.randint(2, 20) 
         c = utilities.randRGBA()
         Planet(x, y, z, h, w, c)
Esempio n. 7
0
File: orbits2.py Progetto: msarch/py
 def start(self):
     """ First thing to happen after the instance has been initalisiated
         good place to instanciate classes and init stuff
     """
     for z in range(100):
         x = utilities.randint(0, self.width)
         y = utilities.randint(0, self.height)
         h = utilities.randint(2, 20)
         w = utilities.randint(2, 20)
         c = utilities.randRGBA()
         Planet(x, y, z, h, w, c)
Esempio n. 8
0
    def start(self) :
        self.nextstep = [0,0] # note is array and not tupple. Speed of each step
##        self.perching = 0
##        self.perch_timer = 0
        self.f1 = 0
        self.f2 = 0
        self.f3 = 0

        self.loc = utilities.randPoint(0, 0, self.app.width, self.app.height)
        self.color = utilities.randRGBA()
        self.width = utilities.randint(6,12)
        self.height = utilities.randint(6,12)
Esempio n. 9
0
File: snow.py Progetto: enrike/mirra
 def start(self):
     """ First thing to happen after the instance has been initalisiated
         good place to instanciate classes and init stuff
     """
    
     self.wind = utilities.randint(-2,2)
     
     for z in range(100):
         x = utilities.randint(0, self.width)
         y = utilities.randint(-150, 0) 
         d = utilities.randint(5,10)
         Flake(x,y,z,d,d,color=(0,1,0,float(d)/10))
Esempio n. 10
0
    def start(self):
        """ First thing to happen after the instance has been initalisiated
            good place to instanciate classes and init stuff
        """

        self.wind = utilities.randint(-2, 2)

        for z in range(100):
            x = utilities.randint(0, self.width)
            y = utilities.randint(-150, 0)
            d = utilities.randint(5, 10)
            Flake(x, y, z, d, d, color=(0, 1, 0, float(d) / 10))
Esempio n. 11
0
    def start(self):
        self.nextstep = [0,
                         0]  # note is array and not tupple. Speed of each step
        ##        self.perching = 0
        ##        self.perch_timer = 0
        self.f1 = 0
        self.f2 = 0
        self.f3 = 0

        self.loc = utilities.randPoint(0, 0, self.app.width, self.app.height)
        self.color = utilities.randRGBA()
        self.width = utilities.randint(6, 12)
        self.height = utilities.randint(6, 12)
Esempio n. 12
0
 def start(self):
     """ First thing to happen after the instance has been initalisiated
         good place to instanciate classes and init stuff
     """
     ##        self.trails = 1
     for z in range(50):
         x, y = utilities.randPoint(0, 0, self.height, self.width)
         s = utilities.choice(
             (GLU_LINE, GLU_FILL, GLU_SILHOUETTE, GLU_POINT))
         Expands(x,
                 y,
                 z,
                 utilities.randint(1, 300),
                 utilities.randRGBA(),
                 utilities.randint(1, 140),
                 style=s).interactiveState = 2
Esempio n. 13
0
File: orbits2.py Progetto: msarch/py
 def start(self):
     super(Planet, self).start() # just extending start from superclass
     for x in range(utilities.randint(1,3)): # some moons with me as center
         n = utilities.random()
         p = Planetoid(self.x, self.y, self.z, self.height*n, self.width*n, self.color)
         p.center = self # overwrite the original value
         p.r *= 15 # want them with more orbit radius
Esempio n. 14
0
 def step(self):
     self.y += self.deltaY
     self.x += self.app.wind
     if self.y >= self.app.height or self.x <= 0 or self.x >= self.app.width:
         self.y = 0
         self.x = utilities.randint(0, self.app.width)
         self.setState()
     self.rotation += self.rotDelta
Esempio n. 15
0
File: snow.py Progetto: enrike/mirra
 def step(self):
     self.y += self.deltaY
     self.x += self.app.wind
     if self.y >= self.app.height or self.x <= 0  or self.x >= self.app.width :
         self.y = 0
         self.x = utilities.randint(0, self.app.width)
         self.setState()
     self.rotation += self.rotDelta
Esempio n. 16
0
 def start(self):
     """ do some dragggable circles
     """
     for z in range(100):
         x, y = utilities.randPoint(0, 0, self.size[0], self.size[1])
         w = utilities.randint(0, 100)
         c = Circle(x,y,z,w, color = utilities.randRGBA())
         c.interactiveState = 2 # draggable
Esempio n. 17
0
 def start(self):
     """ First thing to happen after the instance has been initalisiated
         good place to instanciate classes and init stuff
     """
     for i in range(100):
         x, y = utilities.randPoint(0, 0, self.width, self.height)
         d = utilities.randint(10, 30)
         bl = Blob(x, y, i + 1, d, d, utilities.randRGBA())
         bl.interactiveState = 2  #draggable
Esempio n. 18
0
 def start(self):
     """ First thing to happen after the instance has been initalisiated
         good place to instanciate classes and init stuff
     """
     for i in range(100):
         x,y = utilities.randPoint(0, 0, self.width, self.height)
         d = utilities.randint(10, 30)
         bl = Blob(x, y, i+1, d, d, utilities.randRGBA())
         bl.interactiveState = 2 #draggable
Esempio n. 19
0
 def start(self):
     self.rect = 0,0, self.size[0], self.size[1]
     self.drunks = []
     for z in range(100):
         x,y = utilities.randPoint(rect=self.rect)#0,0, self.size[0], self.size[1])
         w = utilities.randint(20,40)
         c = utilities.randRGBA()
         s = utilities.choice((GLU_LINE, GLU_FILL, GLU_SILHOUETTE, GLU_POINT))
         self.drunks.append(Drunk(x,y,z,w, color=c, style=s))
Esempio n. 20
0
File: orbits2.py Progetto: msarch/py
 def start(self):
     super(Planet, self).start()  # just extending start from superclass
     for x in range(utilities.randint(1,
                                      3)):  # some moons with me as center
         n = utilities.random()
         p = Planetoid(self.x, self.y, self.z, self.height * n,
                       self.width * n, self.color)
         p.center = self  # overwrite the original value
         p.r *= 15  # want them with more orbit radius
Esempio n. 21
0
 def start(self):
     """ First thing to happen after the instance has been initalisiated
         good place to instanciate classes and init stuff
     """
     for z in range(20):
         w, h = self.size
         x, y = utilities.randPoint(1, 1, w, h)
         s = Shape(x, y, z, 50, (0.5, 0, 8, 0.2, 0.7))
         s.interactiveState = 2
         s.rotation = utilities.randint(1, 360)
Esempio n. 22
0
 def start(self):
     """ First thing to happen after the instance has been initalisiated
         good place to instanciate classes and init stuff
     """
     for z in range(20):
         w,h = self.size
         x,y = utilities.randPoint(1,1,w,h)
         s = Shape(x, y, z, 50, (0.5, 0,8, 0.2, 0.7))
         s.interactiveState = 2
         s.rotation = utilities.randint(1,360)
Esempio n. 23
0
    def start(self):
        """ First thing to happen after the instance has been initalisiated
            good place to instanciate classes and init stuff
        """
        f = utilities.path("data/ixi2.png")

        for i in range(50):
            x,y = utilities.randPoint(0, 0, self.width, self.height)
            d = utilities.randint(30, 50)
            bl = ImageBlob(f, x, y, i, d, d)
            bl.interactiveState = 2 #draggable
Esempio n. 24
0
    def start(self):
        """ First thing to happen after the instance has been initalisiated
            good place to instanciate classes and init stuff
        """
        f = utilities.path("data/ixi2.png")

        for i in range(50):
            x, y = utilities.randPoint(0, 0, self.width, self.height)
            d = utilities.randint(30, 50)
            bl = ImageBlob(f, x, y, i, d, d)
            bl.interactiveState = 2  #draggable
Esempio n. 25
0
 def start(self):
     """ First thing to happen after the instance has been initalisiated
         good place to instanciate classes and init stuff
     """
     self.trails = 1
     self.bgColor = 1, 1, 0, 0.06 # an alpha value causes fade out (better with values between 0.02 - 0.1)
     self.mouseVisible = 0 # hide mouse
     
     for z in range(100):
         w,h = self.size
         x,y = utilities.randPoint(0,0,w,h)
         d = utilities.randint(20, 50)
         rot = utilities.randint(1, 360)
         c = utilities.randRGBA()
         stroke = utilities.randint(0, (d/2)-5)
         deltax = deltay = 0
         while deltax==0 : deltax = utilities.randint(-20, 20)/10.0
         while deltay==0 : deltay = utilities.randint(-20, 20)/10.0
         b = BouncingBall(x, y, z, d, c, stroke, rot)#, style=GLU_POINT)
         b.delta = [deltax, deltay]
Esempio n. 26
0
 def start(self):
     self.rect = 0, 0, self.size[0], self.size[1]
     self.drunks = []
     for z in range(100):
         x, y = utilities.randPoint(
             rect=self.rect)  #0,0, self.size[0], self.size[1])
         w = utilities.randint(20, 40)
         c = utilities.randRGBA()
         s = utilities.choice(
             (GLU_LINE, GLU_FILL, GLU_SILHOUETTE, GLU_POINT))
         self.drunks.append(Drunk(x, y, z, w, color=c, style=s))
Esempio n. 27
0
    def start(self):
        """ First thing to happen after the instance has been initalisiated
            good place to instanciate classes and init stuff
        """
        self.trails = 1
        self.bgColor = 1, 1, 0, 0.06  # an alpha value causes fade out (better with values between 0.02 - 0.1)
        self.mouseVisible = 0  # hide mouse

        for z in range(100):
            w, h = self.size
            x, y = utilities.randPoint(0, 0, w, h)
            d = utilities.randint(20, 50)
            rot = utilities.randint(1, 360)
            c = utilities.randRGBA()
            stroke = utilities.randint(0, (d / 2) - 5)
            deltax = deltay = 0
            while deltax == 0:
                deltax = utilities.randint(-20, 20) / 10.0
            while deltay == 0:
                deltay = utilities.randint(-20, 20) / 10.0
            b = BouncingBall(x, y, z, d, c, stroke, rot)  #, style=GLU_POINT)
            b.delta = [deltax, deltay]
Esempio n. 28
0
    def start(self):
        """ First thing to happen after the instance has been initalisiated
            good place to instanciate classes and init stuff
        """

        for z in range(50):
            v = []
            x,y = utilities.randPoint(0, 0, self.width, self.height)
            for j in xrange(4):
                v.append( utilities.randPoint(x-100, y-100, x+100, y+100) )
            d = utilities.randint(10, 30)
##            bl = Marquee(x, y, z, d, d, color=(1,0,0,1), stroke=1)
            bl = Marquee(v, z, color=utilities.randRGB(), stroke=1)
            bl.interactiveState = 2 #draggable
Esempio n. 29
0
    def start(self):
        """ First thing to happen after the instance has been initalisiated
            good place to instanciate classes and init stuff
        """

        for z in range(50):
            v = []
            x, y = utilities.randPoint(0, 0, self.width, self.height)
            for j in xrange(4):
                v.append(
                    utilities.randPoint(x - 100, y - 100, x + 100, y + 100))
            d = utilities.randint(10, 30)
            ##            bl = Marquee(x, y, z, d, d, color=(1,0,0,1), stroke=1)
            bl = Marquee(v, z, color=utilities.randRGB(), stroke=1)
            bl.interactiveState = 2  #draggable
Esempio n. 30
0
    def __init__(self, y=10, z=0, h=10, color=(0, 0, 0), size=(0,0)):
        tl= (0,   y - (h/2))
        tr= (size[0], y - (h/2))
        br= (size[0], y + (h/2))
        bl= (0,   y + (h/2))
        v = [tl,tr,br,bl] # poligon vertex

        #Polygon.__init__(self, v, z, color)
        super(Strippe, self).__init__(v, z, color)

        self.size = size
        self.y = y
        self.h = h

        self.deltaY = 0
        while self.deltaY == 0 :
            self.deltaY = utilities.randint(-200, 200) / 100
Esempio n. 31
0
    def __init__(self, y=10, z=0, h=10, color=(0, 0, 0), size=(0, 0)):
        tl = (0, y - (h / 2))
        tr = (size[0], y - (h / 2))
        br = (size[0], y + (h / 2))
        bl = (0, y + (h / 2))
        v = [tl, tr, br, bl]  # poligon vertex

        #Polygon.__init__(self, v, z, color)
        super(Strippe, self).__init__(v, z, color)

        self.size = size
        self.y = y
        self.h = h

        self.deltaY = 0
        while self.deltaY == 0:
            self.deltaY = utilities.randint(-200, 200) / 100
Esempio n. 32
0
 def doTimeOut(self):
     return time.time() + utilities.randint(120,
                                            240)  # 120, 240) # 2 to 4 min
Esempio n. 33
0
 def doTimeOut(self):
     return time.time() + utilities.randint(60, 120)  #secs
Esempio n. 34
0
 def doTimeOut(self):
     return time.time()+ utilities.randint(1, 5)
Esempio n. 35
0
File: pong.py Progetto: msarch/py
 def startGame(self) : 
     self.loc = 0, utilities.randint(0,self.app.height)
     self.vector = utilities.randint(4,8), utilities.randint(-8,8)
Esempio n. 36
0
 def calcDelta(self):
     deltax = utilities.randint(-20, 20)*0.1 # while deltax==0 : 
     deltay = utilities.randint(-20, 20)*0.1 # while deltay==0 :
     return [deltax,deltay] # needs to be an array because it changes
Esempio n. 37
0
File: orbits2.py Progetto: msarch/py
 def start(self):
     self.r = utilities.randint(1, 3)
     self.inc = utilities.choice([1, -1])
     self.rotation = utilities.randint(1, 360)
     self.center = self  # this is be because later i might overwirte this value to orbit around other things
Esempio n. 38
0
 def startGame(self):
     self.loc = 0, utilities.randint(0, self.app.height)
     self.vector = utilities.randint(4, 8), utilities.randint(-8, 8)
Esempio n. 39
0
 def start(self):
     self.r = utilities.randint(1,10)
     self.inc = utilities.choice([1,-1])
     self.rotation = utilities.randint(1,360)
Esempio n. 40
0
 def doTimeOut(self) :
     return time.time()+ utilities.randint(120, 240) # 120, 240) # 2 to 4 min
Esempio n. 41
0
 def calcDelta(self) :
     deltax = deltay = 0
     i = 4 # max step
     while deltax == 0 : deltax = utilities.randint(-i, i)#/300.0
     while deltay == 0 : deltay = utilities.randint(-i, i)#/300.0
     return [deltax, deltay] # needs to be an array because it changes
Esempio n. 42
0
 def doRandRange(self, pos):
     sense = utilities.seed.choice([-1,1])
     d = utilities.randint(20,100)*sense
     r = utilities.randint(1,5)*sense
     return xrange(pos, pos+d, r)
Esempio n. 43
0
 def doTimeOut(self):
     return time.time() + utilities.randint(5, 10)
Esempio n. 44
0
 def doTimeOut(self) :
     return time.time() + utilities.randint(60, 120) #secs
Esempio n. 45
0
File: orbits2.py Progetto: msarch/py
 def start(self):
     self.r = utilities.randint(1,3)
     self.inc = utilities.choice([1,-1])
     self.rotation = utilities.randint(1,360)
     self.center = self # this is be because later i might overwirte this value to orbit around other things
Esempio n. 46
0
 def doRandRange(self, pos):
     sense = utilities.seed.choice([-1, 1])
     d = utilities.randint(20, 100) * sense
     r = utilities.randint(1, 5) * sense
     return xrange(pos, pos + d, r)