Triggers, Blocks
Last updated
Last updated
There are different types of triggers players can interact with.
items_loot_trigger - opens loot window with items inside
money_loot_trigger - adds money to player and show message on the screen at left side
usable_trigger - adds event key to the player (in editor you create your string id for it and inside p_game.gd you give this event description inside on_event_key_add function)
And non-interactable triggers such as block! Blocks just block raycast from camera to prevent player interact with objects through the walls of rooms etc.
Let's place money_loot_trigger.tscn on the scene and set money value to 100.
Then let's place block between spawn point and money trigger. Go to ZONES/ folder and place block.tscn prefab on the scene.
Set scale as you want. Now if we play this level - we can't use money trigger. You can see colliders, small box is our money trigger.
Delete block by selecting it inside node tree and clicking RMB and selecting Delete Node (s). Or Delete button on keyboard.
Save level and try again to hover the crosshair on the money trigger.
Now we can use this trigger and get our money.