June 2018
Beginner to intermediate
298 pages
7h 38m
English
Now that the level is complete, attach a script to create the level behavior. This script will first scan the Items map to spawn any enemies and collectibles. It will also serve to monitor for events that occur during gameplay, such as picking up a key or running into an enemy:
extends Node2Dexport (PackedScene) var Enemyexport (PackedScene) var Pickuponready var items = $Itemsvar doors = []
The first two variables contain references to the scenes that will need to be instanced from the Items map. Since that particular map node will be referenced frequently, you can cache the $Items lookup in a variable to save some time. Finally, an array called doors will contain the door location(s) found on the map.
Save the script and dr ...
Read now
Unlock full access