def main(): global balls arena = actors.Arena(screen_x, screen_y) balls.append( actors.Ball(0 + radius, arena.get_size()[1] // 2, radius, arena)) balls.append( actors.Ball(0 + radius + second_ball_distance, arena.get_size()[1] // 2, radius, arena)) game2d.canvas_init((arena.get_size())) game2d.set_interval(update, 1000 // 30)
def startup(self): random.seed(datetime.time()) self.jogador = actors.Paddle(340, 600, self.player_image) self.bolinha = actors.Ball(random.randint(300, 600), random.randint(250, 400), self.ball_image) for i in range(self.total_blocos): self.bloco.append( actors.Blocks(1 + 90 * (i % 9), 35 + 35 * math.floor(i / 9), self.cores_blocos[math.floor(i / 9) % 8]))
import math, actors, game2d screen_x = screen_y = 500 radius = 10 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)) arena = actors.Arena(screen_x, screen_y) game2d.canvas_init(arena.get_size()) ball = actors.Ball(0 + radius, arena.get_size()[1] // 2, radius, arena) game2d.set_interval(update, 1000 // 30)