Example #1
0
File: Pong.py Project: JamesR1/pi3d
      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()
    mykeys.close()
    mymouse.stop()
    break
  elif k==112:  #key P
    display.screenshot("pong.jpg")
Example #2
0
  mytcone.draw(coffimg)
  mytcone.rotateIncY(2)
  mytcone.rotateIncZ(-1)

  mytorus.draw(patimg)
  mytorus.rotateIncY(3)
  mytorus.rotateIncZ(1)

  mylathe.draw(patimg)
  mylathe.rotateIncY(2)
  mylathe.rotateIncZ(1)

  myPlane.draw(coffimg)
  myPlane.rotateIncY(9)

  Draw.string(arialFont, "Raspberry Pi ROCKS!",
              -0.8, -0.7, -2.2, 10.0, 0.003, 0.003)
  #pi3d.drawString(destineFont,"Some nice OpenGL bitmap fonts to play with",-1.3,-0.3,-2.2, 10.0, 0.002,0.002)

  k = mykeys.read()
  if k >-1:
    if k==112: display.screenshot("shapesPic.jpg")
    elif k==27:
      mykeys.close()
      texs.deleteAll()
      display.destroy()
      break
    else:
      print k

  display.swapBuffers()