if region != -1: bounce_idx = region + bounce_idx - 2 if bounce_idx < 0: bounce_idx = 0 if bounce_idx > 6: bounce_idx = 6 ball_dx = -ball_dx if bally < BARRIER_BOTTOM or bally > BARRIER_TOP: bounce_idx = 6 - bounce_idx if (ballx < BARRIER1): reset() if (ballx > BARRIER2): reset() circle = gen_circle(ballx, bally, BALL_RADIUS) circle2 = gen_circle(ballx, bally, BALL_RADIUS-2) LD.set_color(RED) LD.draw_quadratic_bezier(circle, 10) LD.set_color(GREEN) LD.draw_quadratic_bezier(circle2, 6) LD.set_color([0xff,0x00,0x20]) LD.draw_line(PLAYER1_X, player1-20, PLAYER1_X, player1+20) LD.set_color([0x20,0xff,0xff]) LD.draw_line(PLAYER2_X, player2-20, PLAYER2_X, player2+20) LD.draw_text("%02i"%(score1), 20, 220, 20) LD.draw_text("%02i"%(score2), 235, 220, 20) LD.show_frame()
LD.set_color([0xff, 0x00, 0xff]) mouse = gen_circle(MIN_BORDER, MIN_BORDER, 1) LD.draw_quadratic_bezier(mouse, 2) mouse = gen_circle(MIN_BORDER, MAX_BORDER, 1) LD.draw_quadratic_bezier(mouse, 2) mouse = gen_circle(MAX_BORDER, MAX_BORDER, 1) LD.draw_quadratic_bezier(mouse, 2) mouse = gen_circle(MAX_BORDER, MIN_BORDER, 1) LD.draw_quadratic_bezier(mouse, 2) mouse = gen_circle(m_x, m_y, 3) LD.draw_quadratic_bezier(mouse, 2) LD.set_color([0xff, 0x00, 0x00]) if curvelen >= 3: LD.draw_quadratic_bezier(curve, 8); if curvelen % 2 == 0 and curvelen > 0: vec = [m_x - curve[-1][0], m_y - curve[-1][1]] ctl_x = curve[-1][0]-vec[0] ctl_y = curve[-1][1]-vec[1] circle = gen_circle(ctl_x, ctl_y, 2) #circle = gen_circle(curve[curvelen-1][0], curve[curvelen-1][1], 2) LD.set_color([0x00,0xff,0xff]) LD.draw_quadratic_bezier(circle,4) LD.draw_quadratic_bezier([curve[-2],[ctl_x,ctl_y],curve[-1]], 5) LD.show_frame();