Blocking an exit

ADRIFT 5 Help ›› Creating Games ›› Tutorials ›› Beginner ››
Parent Previous Next

Blocking an exit

There are many situations where you might want to prevent the player from moving in a particular direction.


Look for the BlockExits.taf file in the Samples folder for an example you can load up.


There are two ways that you can block an exit in ADRIFT.  The way you do it depends whether or not you want the exit to show up on the map.


We are going to use the following layout in this example.  The player starts off in location "Start", and will be restricted from moving both North and South until the player types "one" and "two" respectively.


Hiding the exit

If you want the exit to be hidden on the map until the player is able to move in that direction, you must add the restrictions to the direction within the location.


In the Directions tab of the location, click on the icon next to the <No Restrictions Defined> dropdown next to the direction you want to restrict the movement of.  This will bring up the Restriction editor.  Add whatever restriction you want.  In this example, we have required that a particular task must have been run.



This will update the Direction like so:



In Runner, if you try to move North you will get the above error message stating that you cannot.  In addition, the exit will not show up on the map:



Once you have passed the restriction on the direction (i.e. you have typed "one"), the exit will show up.  When you move to the location, the link will show up as a dotted line, showing that the restriction was previously restricted, like so:


Showing the exit

If you want the exit to show up on the map but still want to prevent movement, you can override the Player Movement task.


To do this, create a new Specific Task and select the Player Movement from the task dropdown, keeping override selected in the first dropdown.


In the Direction reference, select South, i.e. the direction you want to block.



Ensure that you have selected the Task is Repeatable checkbox, so the movement task is overridden every time.


As it stands, this would now block every movement South in the whole game, so we need to add a couple of restrictions.  We need to specify that:



The output text from both of these restrictions should be left blank, otherwise they would override the default player movement task.



In Runner, if you now try to move South you will get the above error message saying you cannot.  In contrast to the North exit, the exit south will always be displayed on the map.