Пример #1
0
def update():
    global x, dx
    game2d.canvas_fill((255, 255, 255))
    game2d.draw_circle((255, 0, 0), (x, y), 25)
    if not (0 <= x + dx <= ARENA_W - W):
        dx = -dx
    x += dx
def update():
    game2d.canvas_fill((255, 255, 255))

    for b in balls:
        b.move(True, True, True)
        x, y, r = b.get_coord()
        game2d.draw_circle((0, 0, 0), (x, y), (r + 2))
        game2d.draw_circle((b.getter()), (x, y), (r))
Пример #3
0
def update():
    game2d.canvas_fill((255, 255, 255))

    ball.move()

    x, y, r = ball.get_coord()
    game2d.draw_circle((0, 0, 0), (x, y), (r + 3))
    game2d.draw_circle((ball.getter()), (x, y), (r))
def update():
    game2d.canvas_fill((255, 255, 255))

    ball.move_sin()
    x, y, r = ball.get_coord()
    game2d.draw_circle((0, 0, 0), (x, y), (r))

    game2d.draw_line((150, 150, 150), (0, arena.get_size()[1] // 2),
                     (arena.get_size()[0], arena.get_size()[1] // 2))
Пример #5
0
 def draw(self):
     game2d.draw_circle(self._color, (self._x, self._y), self._w)
import game2d

cont = 0
raggio = 250
centro_x = 250
centro_y = 250

rosso = 255

game2d.canvas_init((500, 500))

num_cerchi = int(input("Quanti cerchi vuoi disegnare?(Max 250)"))

if num_cerchi >= 0 and num_cerchi <= 250:

    decremento_rosso = 255 // num_cerchi
    decremento_raggio = 250 // num_cerchi
    while cont < num_cerchi:

        game2d.draw_circle((rosso, 0, 0), (centro_x, centro_y), (raggio))
        rosso -= decremento_rosso
        raggio -= decremento_raggio

        cont += 1
else:
    print("Input non valido!")
Пример #7
0
 def draw(self):
     game2d.draw_circle((0, 0, 255), (self._x, self._y), self._w)
Пример #8
0
def update():
    global palla
    game2d.canvas_fill((255,255,255))
    palla.move()
    valori_palla = palla.rect()
    game2d.draw_circle((150,150,150),(valori_palla[0],valori_palla[1]),(valori_palla[2]))
import game2d
import random

raggio = 50

cont = 0

game2d.canvas_init((500, 500))
num_cerchi = int(input("Quanti cerchi vuoi disegnare ?"))

if num_cerchi >= 0:
    while cont < num_cerchi:

        red = random.randint(0, 255)
        green = random.randint(0, 255)
        blue = random.randint(0, 255)

        center_x = random.randint(0 + raggio, 500 - raggio)
        center_y = random.randint(0 + raggio, 500 - raggio)

        game2d.draw_circle((0, 0, 0), (center_x, center_y), (raggio + 3))
        game2d.draw_circle((red, green, blue), (center_x, center_y), (raggio))

        cont += 1
else:
    print("Input non valido")
import game2d
import random

game2d.canvas_init((500, 500))

rosso = random.randint(0, 255)
verde = random.randint(0, 255)
blu = random.randint(0, 255)

centro_x = 250
centro_y = 250

raggio = 250

while raggio >= 10:

    game2d.draw_circle((rosso, verde, blu), (centro_x, centro_y), (raggio))
    rosso = random.randint(0, 255)
    verde = random.randint(0, 255)
    blu = random.randint(0, 255)
    raggio -= random.randint(0, raggio - 5)