I tried setting a global variable and, when below a certain number, a "warning alarm" goes off.
But when the number goes back up, it won't shut off.
health < 20
alarmOn = false ..... Play "alarm" sound, alarmON = true
health > 20
alarmOn = true ......Stop "alarm" sound, alarmON = false
and no go.
Any help will be appreciated.
Make alarmOn a global variable and use 0 for FALSE and use 1 for TRUE
alarmOn = 1 > Play "alarm"
alarmOn = 0 > Stop "alarm"
health<20 > Set alarmOn "1"
health>20 > Set alarmOn "0"
Develop games in your browser. Powerful, performant & highly capable.
You can also try a every x seconds with else:
Health < 20
Every x seconds - play alarm
Else - stop alarm