Flash Light with Battery Timer

Underserial

Veteran
Veteran
Joined
Dec 9, 2015
Messages
109
Reaction score
20
First Language
German
Hello Guys,


i need your help.


I want to create an script for which you need batterys to keep your flashlight alive.


There are 3 bars and every minute 1 bar is going down and if you have 0 bars left - the flashlight would not work.


I already have an script that you get the flashlight, but dont have a plan how to get the "battery script" working.


Any ideas?
 

Astfgl66

Veteran
Veteran
Joined
Jan 5, 2016
Messages
722
Reaction score
578
First Language
French
Primarily Uses
This should be easily acheived via a common event.


You need a variable that will contain the duration of the battery. Set it to the duration you'd like to have when you first get the flashlight or when you get new batteries.


Then periodically decrease this variable via the common event if the flashight is active. (Do something like wait 60 frames, variable -=1 )


At certain threshold you can change the imagine that represent your battery bars: lets say you first set the variable to 180, you'd changes images at 120, 60 and 0 probably.


Then if the variable is 0, you make the flashlight disappear.


I don't know your light system so I can't say much about activating or deactivating the light but this should get you a simple battery system going.
 
Last edited by a moderator:

Underserial

Veteran
Veteran
Joined
Dec 9, 2015
Messages
109
Reaction score
20
First Language
German
got it thx
 
Last edited by a moderator:

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD
How many parameters is 'too many'??

Forum statistics

Threads
105,862
Messages
1,017,045
Members
137,569
Latest member
Shtelsky
Top