Beispiel #1
0
            score[0] += 1
            score0 = String(camera, light, arialFont, str(score[0]), 0, 12, -5,
                            0.05, 0.05)
            score0.set_shader(flatsh)
            radius = 0.1 + (
                radius - 0.1) * 0.75  # ball gets smaller each time you score
            ball = Sphere(camera, light, radius, 12, 12, 0.0, "sphere", 0, 0,
                          0)
            ball.buf[0].set_draw_details(shader, [ballimg], 0.0, 0.0)
            maxdsz += 0.01  # max speed in z direction increases too
            sx, sy, sz = 0, mapheight / 3, 0
            dsx, dsy, dsz = 0.3 * random.random() - 0.15, 0, -0.1

    ball.position(sx, sy, sz)

    ball.rotateIncX(dsz / radius * 50)

    defocus.start_blur()
    ball.draw()
    mymap.draw()
    myecube.draw()
    defocus.end_blur()

    defocus.blur(ball, 4, 15, 2)
    defocus.blur(mymap, 4, 15, 2)
    defocus.blur(myecube, 4, 15, 2)

    monster.draw()

    # write up the score
    score0.draw()
Beispiel #2
0
      dsx, dsy, dsz = 0.3*random.random()-0.15, 0, 0.1
      score[1] += 1
  if sz < -maphalf: #monster end
    if (sx-rx)**2 + (sy-ry)**2 < 10:
      dsz = abs(dsz)
    else:
      score[0] += 1
      radius = 0.1 + (radius - 0.1)*0.75 # ball gets smaller each time you score
      ball = Sphere(radius,12,12,0.0,"sphere",0,0,0)
      maxdsz += 0.01 # max speed in z direction increases too
      sx, sy, sz = 0, mapheight/3, 0
      dsx, dsy, dsz = 0.3*random.random()-0.15, 0, -0.1

  ball.position(sx, sy, sz)

  ball.rotateIncX(dsz/radius*50)

  monster.draw(monstimg)
  ball.draw(ballimg)

  # write up the score
  Draw.string(arialFont, str(score[0]), -10, 20, -5, 0.0, 0.05, 0.05)
  Draw.string(arialFont, str(score[1]), 10, 20, -5, 0.0, 0.05, 0.05)

  display.swapBuffers()

  #Press ESCAPE to terminate
  k = mykeys.read()

  if k==27: #Escape key
    display.destroy()