How to do it...

Let's run the following 3dMaze.py script by performing the following steps:

  1. First, we set up the keyboard, mouse, display, and settings for the model using the following code:
#!/usr/bin/python3 """Small maze game, try to find the exit """ from math import sin, cos, radians import demo import pi3d from pi3d.shape.Building import Building, SolidObject from pi3d.shape.Building import Size, Position KEY = {'A':97,'D':100,'H':104,'R':114,'S':115,'T':116, 'W':119,'ESC':27,'APOST':39,'SLASH':47,'NONE':-1} # Setup display and initialise pi3d DISPLAY = pi3d.Display.create() #capture mouse and key presses mykeys = pi3d.Keyboard() mymouse = pi3d.Mouse(restrict = False) #Load shader shader = pi3d.Shader("uv_reflect") flatsh = pi3d.Shader("uv_flat") ...

Get Raspberry Pi 3 Cookbook for Python Programmers - Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.