![]() |
Attention | Topic was automatically imported from the old Question2Answer platform. |
![]() |
Asked By | iAbrees |
I want my flashlight to be like:
On = losing battery life
Off = stop losing battery life
PLS Help
![]() |
Attention | Topic was automatically imported from the old Question2Answer platform. |
![]() |
Asked By | iAbrees |
I want my flashlight to be like:
On = losing battery life
Off = stop losing battery life
PLS Help
![]() |
Reply From: | magicalogic |
Add a script to your spotlight and add this code.
extends SpotLight
var battery_amount = 100
var drain_rate = 2
var on = true
func _process(delta):
if on:
battery_amount -= drain_rate * delta
light_energy = battery_amount / 100
drain_rate
is how fast the battery drains.
You can turn on or of the flashlight by setting the on variable to true or false.
Thanks bother
iAbrees | 2022-12-27 15:08