Spawn Points / Teleporting
Set up basic check points or teleporting.
Image for post
Note: This system requires your Avatar to die and respawn for it to work. Currently, you cannot do the teleport system without dying so you need to consider this when designing your game.
- Click the ‘Global Parameters’ buttons at the top of the bar.
- Click the ‘Controller’ tab
- Click the ‘Components’ tab. Here we can set the Avatars Health and Death settings.
- In ‘Health Component’ settings under the ‘Death Event’ field select ‘RespawnToTag’
- In the ‘Respawn Tag’ add your tag. In this example, we used ‘spawn1’. Any object in the Game with a tag ‘spawn1’ will be used as a spawn point when the Avatar dies.
- ‘Death Delay’ is how long your Avatar lays dead on the ground for before respawning. We used ‘-2’ in this example because it makes the Avatar respawn instantly without having a dying animation.
- Changed the default ‘Instant Death Message’ message to anything else so you got full control of when this happens. In this example, we used 'Killx'.
Now when your Avatar dies it will look for the closest object with the tag ‘spawn1’ and spawn your Avatar at that location. If it cannot locate the Tag it will spawn you at your starting or current location.
- Place down an asset to use as a spawn point. We recommend using a default object of the Game Maker to avoid issues on the client's end. In this example, we used ‘Stone Carving’ as its flat and a good size to manage.
- Select your spawn point and add a Tag to it named ‘spawn1’
Image for post
Now when the Avatar dies he will spawn on top of that Stone Carving. You can make the object invisible or just push underground just enough to not be seen.