-
Notifications
You must be signed in to change notification settings - Fork 34
/
Copy pathFleisch.gd
59 lines (55 loc) · 1.14 KB
/
Fleisch.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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
extends Control
export(int, 0, 100, 1) var amount = 100 setget set_amount
onready var f1 = get_node("HBoxContainer/Fleisch1")
onready var f2 = get_node("HBoxContainer/Fleisch2")
onready var f3 = get_node("HBoxContainer/Fleisch3")
onready var f4 = get_node("HBoxContainer/Fleisch4")
onready var f5 = get_node("HBoxContainer/Fleisch5")
onready var animation = get_node("AnimationPlayer")
func _ready():
# Called every time the node is added to the scene.
# Initialization here
pass
func set_amount(val):
if f1 == null: return
if val < 20:
if animation.get_current_animation() != "blink":
animation.play("blink")
else:
animation.play("normal")
if val <= 0:
f1.hide()
f2.hide()
f3.hide()
f4.hide()
f5.hide()
elif val > 0 and val < 20:
f1.show()
f2.hide()
f3.hide()
f4.hide()
f5.hide()
elif val >= 20 and val < 40:
f1.show()
f2.show()
f3.hide()
f4.hide()
f5.hide()
elif val >= 40 and val < 60:
f1.show()
f2.show()
f3.show()
f4.hide()
f5.hide()
elif val >= 60 and val < 80:
f1.show()
f2.show()
f3.show()
f4.show()
f5.hide()
elif val >= 80:
f1.show()
f2.show()
f3.show()
f4.show()
f5.show()