[2Ed] Chapter 35: Prototype 7: Dungeon Delver
In this chapter, you make a top-down adventure game similar to the original Legend of Zelda for the NES. This chapter replaces the QuickSnap and Omega Mage prototypes from the first edition, and the new chapter includes much more component-oriented coding and a more interesting game.
Some people have had difficulty importing the starter unitypackage, so here is a starter project with the unitypackage already installed:
Dungeon Delver Level Editor Package
This UnityPackage includes a __Dungeon_Editor folder with all the things you need to edit mapData in it. Please be sure to read the ___Instructions_for_Dungeon_Delver_Editor___ text file in that folder.
Improved Spiker Code
This version of the Spiker code will move to the position where Dray was spotted, rather than having movement based on the room and the position of the Spiker in the room. It’s also simpler! You’ll need to change the filename to “Spiker.cs”.
Unity 2018.2.2 – Camera.main Bug
- In Unity 2018.2.2, sometimes when creating a Camera, the tag of the Camera is set to “Untagged” instead of “MainCamera”. As a result, any references to Camera.main will cause Null Reference Exceptions.
- To remedy this, all you need to do is set the tag of the Main Camera to MainCamera.
Small Unity 2017+ Issues
- The second edition was written before Unity announced or released their Tilemap engine for 2D games, so the Dungeon Delver tutorial (Ch. 35) uses an engine that I wrote instead. However, the Unity Tilemap engine does cause scripts of specific names to have unique icons. These include “Tile”, “GameManager”, and others. If you see a strange icon for these scripts, it’s nothing to worry about.
Minor Errata in Text
- p.846 – At the top of the page, in the non-bold code from before, this line:
eTileNum = TileCamera.MAP[x,y];
should instead read:
eTileNum = TileCamera.GET_MAP(x,y);
Thanks to Brandon Azer for noticing this error.