-
Notifications
You must be signed in to change notification settings - Fork 1
/
UI.gd
36 lines (24 loc) · 890 Bytes
/
UI.gd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
extends CanvasLayer
const ROCKET_RATE = 0.02
const FLASHLIGHT_RATE = 0.08
var rocket_capacity = int(global.rocket_capacity)
var flashlight_capacity = int(global.light_battery)
func _ready():
$RocketValue.text = String(rocket_capacity)+"%"
$BatteryValue.text = String(100)+"%"
$TimeValue.text = String(5.5)+" seconds"
func _on_KinematicBody2D_rocket_launched():
rocket_capacity -= ROCKET_RATE
global.rocket_capacity = rocket_capacity
$RocketValue.text=String(int(rocket_capacity))+"%"
func _on_KinematicBody2D_flashlight_increased():
flashlight_capacity -= FLASHLIGHT_RATE
$BatteryValue.text=String(int(flashlight_capacity))+"%"
func _on_KinematicBody2D_flashlight_decreased():
pass
func _on_rocket_charge_rocket():
rocket_capacity = 100
$RocketValue.text=String(int(rocket_capacity))+"%"
func _process(delta):
if global.lights_fixed:
$light_fixed.visible = true