-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcombat.gd
121 lines (97 loc) · 3.38 KB
/
combat.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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
extends Control
@onready var selected_mob = null
@onready var number_of_use = 3
# Called when the node enters the scene tree for the first time.
func _ready():
pass # Replace with function body.
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
print("use: " + str(number_of_use))
if number_of_use == 0 or number_of_use <= 0:
get_node("Use").visible = true
if get_node("Attack").visible == true:
get_node("Attack").visible = false
elif get_node("Magic").visible == true:
get_node("Magic").visible = false
if has_node("../Grand_monstre/Select") and is_instance_valid(get_node("../Grand_monstre/Select")) or has_node("../Grand_monstre1/Select") and is_instance_valid(get_node("../Grand_monstre1/Select")):
if selected_mob == 1:
get_node("../Grand_monstre/Select").visible = true
get_node("../Grand_monstre1/Select").visible = false
if selected_mob == 2:
get_node("../Grand_monstre/Select").visible = false
get_node("../Grand_monstre1/Select").visible = true
elif selected_mob == null:
pass
else :
pass
func _on_attack_btn_pressed():
if get_node("Magic").visible == true:
get_node("Magic").visible = !get_node("Magic").visible
get_node("Attack").visible = !get_node("Attack").visible
# Replace with function body.
func _on_magic_btn_pressed():
if get_node("Attack").visible == true:
get_node("Attack").visible = !get_node("Attack").visible
get_node("Magic").visible = !get_node("Magic").visible # Replace with function body.
func _on_quit_btn_pressed():
get_node("../Player").position = Vector2(0, 14)
get_node("../Player").visible = true
get_node("../Player").can_move = true # Replace with function body.
func _on_bomb_btn_pressed():
if number_of_use == 0 or number_of_use <= 0:
pass
else :
if selected_mob == 1:
get_node("../Grand_monstre").health -= 40
number_of_use -= 1
elif selected_mob == 2:
number_of_use -= 1
get_node("../Grand_monstre1").health -= 40
# Replace with function body.
func _on_thunder_btn_pressed():
if number_of_use == 0 or number_of_use <= 0:
pass
else :
if selected_mob == 1:
number_of_use -= 1
get_node("../Grand_monstre").health -= 30
elif selected_mob == 2:
number_of_use -= 1
get_node("../Grand_monstre1").health -= 30 # Replace with function body.
func _on_lion_btn_pressed():
if number_of_use == 0 or number_of_use <= 0:
pass
else :
if selected_mob == 1:
number_of_use -= 1
get_node("../Grand_monstre").health -= 50
elif selected_mob == 2:
number_of_use -= 1
get_node("../Grand_monstre1").health -= 50 # Replace with function body.
func _on_life_btn_pressed():
if number_of_use == 0 or number_of_use <= 0:
pass
else :
number_of_use -= 1
get_node("../Player/Camera2D/HearthBar").health += 10
get_node("HearthBar").health += 10 # Replace with function body.
func _on_poison_btn_pressed():
if number_of_use == 0 or number_of_use <= 0:
pass
else :
if selected_mob == 1:
number_of_use -= 1
get_node("../Grand_monstre").health -= 30
elif selected_mob == 2:
number_of_use -= 1
get_node("../Grand_monstre1").health -= 50 # Replace with function body.
func _on_sun_btn_pressed():
if number_of_use == 0 or number_of_use <= 0:
pass
else :
if selected_mob == 1:
number_of_use -= 1
get_node("../Grand_monstre").health -= 5
elif selected_mob == 2:
number_of_use -= 1
get_node("../Grand_monstre1").health -= 5