Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags

Hi Appas Papas,

I'm running into a challenge coding wise and I'm hoping you know what I should do to fix it.  Ok, so, I'm trying to have an animation play after the player goes into one of the rooms and a timer goes to zero.  I've changed the area before the crayon(now crayons) room somewhat and added a couple of jumpscares,  but those are set to run when the scene starts.

 I have the code setup so that when the player body goes into the Area, the Timer would start.  When the Timer times out, the Animation should play.  It doesn't, though.  I tried to have that happen with an object at the room entrance and it did nothing.  I even tried having an Area and Collision shape attached to the Sprite and not attached to the Sprite but in front of it.  Nothing has worked.  

What am I doing wrong?

(1 edit)

Hrm. . . . I'm not sure. I use Unity / C#, and I've never used Godot before. But, here is how I would set it up for Unity:

  1. Depending on the game, I'd have a Rigidbody component either on the trigger GameObj or the player GameObj. Let's say it is on the player.
  2. Create a GameObj that has a Collider on it. *Make sure it is set to trigger!* That's important.
  3. Have a script with code (sorta like this) on the trigger GameObj:
[SerializeField] private float timer = 10f;
[SerializeField] private float timeForAnimation = 3f;
// State
private bool startTimer;
private void Update()
{
    if (startTimer)
    {
        timer -= Time.deltaTime;
        if (timer <= 0f)
        {
            GetComponent<Animator>().SetTrigger("Scare");
            Destroy(gameObject, timeForAnimation); // This could be extracted as a function to use as an anim event
        }
    }
}
private void OnTriggerEnter(Collider other)
{
    if (other.CompareTag("Player") && !startTimer)
    {
        startTimer = true;
    }
}
(1 edit)

Are you sure the timer is working? Have you printed the time remaining on Update? Or print a message inside the if statement that you expect to run after the time runs out?

I hope I was of some sorta help. . .

Hi Appa's Papas,

You were a help in suggesting I check to see if the Timer's working.  From what I remember at first it wasn't and then I got it to work on its own.  Thing is, though, even though the Timer's working, it won't play the AnimationPlayer.

I'm not sure how to do what I'm trying to do, but I went and asked a question on the Godot Community.  Hopefully someone there will know what to do.  If not, well, then I may have to do something else or go and have the scene change to another scene where the character spawns in or near the same area and have the Timer start when the new scene starts.

(+1)

Good news.  I got an answer to my question and, after playing around with the information I got, the Animation Player is now playing my animation like I wanted.  

Yay! I'm glad you got it working. I wish I could've helped more, but I'm pretty new to development.

(+1)

Thank you and I'm glad too.  I'll let you know when the demo updates/changes are done.

Hi Appa's Papas,

Things have finally been updated.  I had gotten my game demo to where I wanted it before today, and then I ran into some challenges with exporting it and stuff and had to redo/fix/change some things.  In any case, I made it so the hallway with the notes has been moved to the beginning and changed a little, the lighting has been changed, the outside environment color has been changed, I've added animations that happen when you're in different areas of the second scene, the music has been updated some, and I've increased the player movement speed.  

Let me know what you think of the updates.

Much better!

  • Lighting was greatly improved. It was dark, but not total black. The fog helped "shape" the rooms, so the back half without the fog was still harder to see, but I like the contrast.
  • None of the jump scares scared me, but I liked the movement of the objects (the crayons and the objects). The drawing that moved in the back then ran away was a nice touch, as was the first one on the right (in the back area).
  • The darker skybox is a major upgrade! It was only truly noticeable with the bathroom-glass wall (since the green is so bright compared to all the other textures), but the darkness was definitely better to see than the blue.
  • That music box music. . . . is both annoying and offsetting. I think it definitely helps set the mood. I kinda even like it. Is it possible to "balance" your music by playing that track slightly softer than the wind one? It's your game, of course, so do what you want. :-D
  • The player speed is spot on! Do you like it faster?
(+1)

I'm glad to hear you think the demo is much better.  As far as the music box music, it wouldn't be a problem to lower the volume.   I'll have to see how it sounds like that, though. I'm glad you think it helps set the mood.  

 As far as the player movement goes, I do prefer it the way it is now.  I had run into one of several issues with my demo and had lost the quicker player speed.  I, however, had exported the demo and forgotten to add it again.  When I played it, it was definately noticable how slow the player was actually moving.  But, in anycase, yeah, the quicker speed's definately better.

As far as the jumpscares are concerned, jumpscares are subjective. I'm glad you liked the movements, though.

Hi Appas Papas,

When you were talking about the music box music being annoying and offsetting, you were talking about it doing a weird double playing thing right?  I didn't realize that until I was playing the last version of my game demo tonight and heard that part of the music playing twice.   I'm sorry about that.  I've gone and updated things, though, and the music, at least from what I can tell, isn't doing that anymore.