spell_holder

main
Just Dzhi 2023-10-02 21:23:17 +04:00
parent e70e005230
commit feef84ebbe
4 changed files with 13 additions and 5 deletions

View File

@ -22,7 +22,7 @@ script = ExtResource( 2 )
use_parent_material = true
frames = ExtResource( 1 )
animation = "idle"
frame = 2
frame = 1
playing = true
centered = false

View File

@ -124,6 +124,7 @@ visible = false
position = Vector2( 11, 2 )
frames = ExtResource( 5 )
animation = "idle"
frame = 1
playing = true
[node name="AudioGetDamage" type="AudioStreamPlayer" parent="."]

View File

@ -26,7 +26,7 @@ var spells = [
func _ready():
Global.playing = true
Global.play_time = 55.0
Global.play_time = 59.0
Global.health = 5
Global.add_health(0)
@ -66,6 +66,6 @@ func _physics_process(delta):
func select_card():
if selected_card != null:
$"../Center/SpellHolder".add_modifier(spells[selected_modifier])
$"UIWrapper/UI/Center/SpellHolder".add_modifier(spells[selected_modifier], selected_modifier)
Global.playing = true
$UIWrapper/UI/Cards.visible = false

View File

@ -1,6 +1,7 @@
extends Control
var cell_preload = preload("res://src/models/spell_cell/SpellCell.tscn")
var icon_preload = preload("res://src/spell_icons/SpellIcon.tscn")
var modifiers = []
func _ready():
@ -9,5 +10,11 @@ func _ready():
spell_cell.rect_position.x += i * (14 + 2)
self.add_child(spell_cell)
func add_modifier(spell_name):
modifiers.append(spell_name)
func add_modifier(spell_name, selected_modifier):
modifiers.append(spell_name)
var spell_icon = icon_preload.instance()
spell_icon.frame = selected_modifier
spell_icon.global_position.x += 7 + (modifiers.size() - 1) * (14 + 2)
spell_icon.global_position.y += 7
self.add_child(spell_icon)