How do you make a jumpscare activate when your character enters a certain area or touches an object?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By SwiftLegend

I just wanted to ask how to make a jumpscare in Godot but I am brand new to Godot and have no idea what I’m doing if anyone could help that would be amazing.

:bust_in_silhouette: Reply From: Ninfur
  1. Add an Area node at the location you want the trigger
  2. Add a CollisionShape as a child node and set its shape in the inspector
  3. Add a script to the Area node, or some node that can easily access it
  4. Connect to the area’s body_entered(body: Node) signal

Now, when any object with a collision shape (and the appropriate layer), enters the area, a signal will be emitted. Check if the body argument is a character, for example by checking its name, group or class. And if it is, start the jumpscare.