Platform Builder Forums
Main => Suggestions => Topic started by: saiwong3268 on December 05, 2019, 07:01:46 PM
-
I am working on a water area. However, what I've found is that I am too focused on avoiding enemies that I forget to check my oxygen level and die through lack of air.
Can you implement a way that
when low on oxygen to get some sort of ALARM sound ? (The alarm sound can turn off when you
go up to the surface or get enough oxygen through bubbles).
-
find an option "Loop Command" and try something like this:
if air < x
{
play sfx = y
loop = staggered
}
where x describes what number do you want your alarm to start, and y stands for a sound effect used.
"loop = staggered" does an action every 5 frames, so that might be too fast. I think it'll work, but you don't know untill you check. :)
-
I'm not sure if that will work. I wondered if that might work, but I doubt it. It's worth a shot though!
-
it does not, you hear this alarm above water. I tried:
if swimming = true
and if breath < 5
{
sfx = 5
loop = staggered
}
seems like it should work, but it doesn't. maybe you need to use a timeline.
-
The and conditional is incorrect. It should be & breath <5. And I didn't think you could cause commands to loop by doing loop=staggered.
-
The and conditional is incorrect. It should be & breath <5. And I didn't think you could cause commands to loop by doing loop=staggered.
I'm reading all commands from the page, and both "and breath <5" and "loop=staggered" are written down.
-
I wasn't aware of the breath command. And I'm aware of the loop constant and staggered commands. I just didn't know that it'd loop commands you wrote down. I thought it only worked in area beginning commands.
-
that may be the case. either way, I can't get it to work. not great with commands. :P
-
I was looking at the command line tutorial
https://theplatformbuilder.com/Conditionals/
maybe try:
if swimming = true & breath < 5
{
sfx = 5
loop = staggered
}
does this work ?
-
It might! Try it out and loop it in the loop command for the sandbox level. Find it by clicking settings. I believe it's at the top right.
-
Creepy memories from Sonic 1...
-
I finally got it to work with the following:
if swimming = true
{
if breath < 3000
{
sfx = 5
loop = staggered
}
}
-
really, it does work?
you're a Mastermind, that's what you are. :o ;)
-
I finally got it to work with the following:
if swimming = true
{
if breath < 3000
{
sfx = 5
loop = staggered
}
}
Good job! Antikore should be proud of you!
(and a bunch of Sonic fans should be eternally grateful to you ;))
-
??? I'm not sure how to interpret that.
-
I have been testing my Sandbox levels and noticed that the swimming alarm code works for 99%
of the situations. However, there was an issue when your characters head is above water whilst
the characters feet are underwater.
I investigated the issue, and concluded that if your character is not swimming,
the value of breath/air is "undefined" (believe it is something like -1)
The issue is when your character is swimming, but has head above water, value of
swimming is true, but breath is "undefined" so alarm sounds
In order to fix this, use the following:
if swimming = true & breath > 0
{
if breath < 3000
{
sfx = 5
loop = staggered
}
}
You can interpret the first 'if statement' as: if character is swimming and breath value is defined
-
don't forget that you could use a variable with a delay command or a looping timeline to loop stuff at your own pace.
-
Could you explain that, TingThing?
-
You guys have talked about doing staggered looping so that the sound effect doesn't play as frequently. But it will still loop quite quickly.
if swimming = true & breath > 0
{
if breath < 3000
{
sfx = 5
loop = staggered
}
}
Thing is, you could just put that into a timeline that loops itself every second. That way the sound effect will only happen every second when the breath amount is low.