Exemplo n.º 1
0
def on_mouse_move(pos, rel):
    dx, dy = rel
    r = math.sqrt( (dx**4)+(dy**4) )
    pos=(integer(0, W), integer(0, H))
    
    c = screen.add_circle( radius=r, pos=pos, color=random_color() )
    items.append(c)

    l = screen.add_label(choice(words), align='center', fontsize=integer(0, 50), color=random_color(), pos=(integer(0, W), integer(0, H)) )
    items.append(l)
Exemplo n.º 2
0
    def __init__(self, cfg, res):
        self.cfg = cfg
        self.res = res
        self.sprite = Sprite("register", self.res, 0.25)

        while True:
            position = random.integer(20,580), random.integer(20,580)
            if position[0] < 20 or position[1] < 20:
                continue
            if 160 <= position[0] and position[0] <= 220:
                continue
            if 380 <= position[0] and position[0] <= 440:
                continue
            if 160 <= position[1] and position[1] <= 220:
                continue
            if 380 <= position[1] and position[1] <= 440:
                continue
            self.position = position
            break
Exemplo n.º 3
0
def update(dt):
    all_items = items[:]
    items[:] = [i for i in items if i.scale > 0.1]
    for i in all_items:
        if i not in items:
            i.delete()
    for item in items:
        item.scale = item.scale * 0.9  # shrink
        item.y = item.y * 1.09  # fall
        item.x = item.x + integer(-3, 3)  # jitter
Exemplo n.º 4
0
    def __init__(self, cfg, res):
        self.cfg = cfg
        self.res = res
        self.sprite = Sprite("register", self.res, 0.25)

        while True:
            position = random.integer(20, 580), random.integer(20, 580)
            if position[0] < 20 or position[1] < 20:
                continue
            if 160 <= position[0] and position[0] <= 220:
                continue
            if 380 <= position[0] and position[0] <= 440:
                continue
            if 160 <= position[1] and position[1] <= 220:
                continue
            if 380 <= position[1] and position[1] <= 440:
                continue
            self.position = position
            break