Exemple #1
0
  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()