============== Labyrinth/maze ============== .. index:: labyrinth maze .. |a| image:: /images/all/blender-basics/f_labyrinth/labyrinth-100.png Objectives ========== .. tabularcolumns:: | c | l | :border: none +-------+-------------------------------------------------------------------------+ | |a| | This station is a repetition of techniques already shown. But wait, | | | it is also the starting point for a game that we build in the End | | | of these course. It is named »Sokoban«. | | | | | | If you don't know this game you can read more about | | | it at :ref:`Game Sokoban ` | +-------+-------------------------------------------------------------------------+ Instructions ============ :Tasks: 1. Construct your own level. 2. Create objects with different shape for each symbol. Labyrinth ========= Our starting point is a maze build out of cubes. .. literalinclude:: files/labyrinth.py :language: python :linenos: :emphasize-lines: 0 Iterate with for ================ The function *len* gives us the number to iterate in a for loop through the lists. .. literalinclude:: files/labyrinth.py :language: python :emphasize-lines: 0 :lines: 39,40 Comparison ========== With each comparison we decide to generate a new object otherwise nothing happened. .. literalinclude:: files/labyrinth.py :language: python :emphasize-lines: 3 :lines: 41-45 Function call with parameter ============================ The function is now called with one of the available levels (level_00, level_01,level_02...). .. literalinclude:: files/labyrinth.py :language: python :emphasize-lines: 0 :lines: 47,48 Result of the script ==================== .. image:: /images/all/blender-basics/f_labyrinth/labyrinth1.png :width: 450px View from top... .. image:: /images/all/blender-basics/f_labyrinth/labyrinth2.png :width: 450px View from an other perspective ...