[SOLVED] How to create a ‘jumpscare’ and restart the game?

Plz help me

Hi @Brent_Reddick! Can you please describe what you try to achieve and what your problem is?

ok I want it where when the enemy attacks it triggers a jumpscare

To me a ‘jumpscare’ is a broad term, so I’m not really sure what you mean by that.

Like for a horror game

I request you make an ai that listens for sound instead of searching (sight)

@Brent_Reddick I think @Albertos is looking for a little better description in order for someone to help. Could you provide a little more context like… When a player gets close to an enemy I would like the player to jump in air and back. Or When an enemy and player get close the enemy jumps and scares player. Sound? Do you have any videos or examples we can look at?

1 Like

This is offtopic here, but request noted. :+1:


when enemy comes close to player trigger jumpscare like fnaf

Is was thinking it could play an animated 2d screen with a loud noise or maybe something else

You can prepare something in the editor and keep it disabled. When you need it you can enable it by script.

// initialize
this.gameOver = false;
this.jumpScareEntity = this.app.root.findByName('JumpScare');
// function
if (!this.gameOver) {
    this.gameOver = true; 
    this.jumpScareEntity.enabled = true;

    }.bind(this), 5000);

hmm ok
but how do I do the jumpscare animation?

I have no idea what you have in mind. Do you have an example?

like from Five Nights At Freddy’s

something like this?

I would start with just a fullscreen image and maybe a sound effect. If you are done, you can also apply a script to let the image shake a bit.

ooh ok

um what about this

ok so you have an example of that?