I have actors spawning and being destroyed with a key press. I would like to have it play a sound if the key is pressed but the actor is NOT destroyed. Any thoughts? Current functionality:
the loop (as you’ve set it up) will always destroy anything in the array. under what conditions will an actor not be destroyed?
The answer to that question becomes a boolean and feeds into a branch node. Then you do whatever you want from the false execution pin.
The actor can only be destroyed when its passing through a small trigger box and the key is pressed. So the player could press the key late after the actor has left the trigger and the key would be pressed but the actor would not be destroyed.
I did try to use a boolean and a branch but I don’t seem to have set it up correctly.
ah i see.
so the conditions are:
- actor is within an overlap
- key is pressed while in overlap
So when the actor begins overlap, set a boolean to true, and when they end overlap, change it to false.
Then when key is pressed, check for this boolean and if it is not true, dont do anything. If it is true, then run the loop.
If key is pressed and no overlap, then you play the sound effect.
Awesome I’ll try this. Thank you!
This worked. Thank you again!
Actually If I can ask one clarifying question. In your steps you said to do nothing if the bool is false. but if they key is pressed and no overlap, then play the sound. If the bool is false wouldn’t that mean no overlap? or am I missing something. Here’s how I set it up:
sorry, i typed sloppy. I think you’ve got it correct there.
The name “not destroyed” might be misleading though. The bool is only indicating whether or not you are overlapped. If you like to make a note about the intention for the bool, you can do so in the description in the details panel, then when you hover over the variable you’ll see that description.
This way in the future you won’t get confused if there is a bool that doesn’t exactly describe what it is indicating
haha awesome thanks. and yes, that bool is named confusingly. I’ll make a note for sure. Many thanks again!
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.