working hand
This commit is contained in:
@@ -19,3 +19,6 @@ func activate(world, activator):
|
||||
for behavior in $Behaviors.get_children():
|
||||
behavior.activate(world, activator)
|
||||
|
||||
func discard(world, activator):
|
||||
for behavior in $Behaviors.get_children():
|
||||
behavior.discard(world, activator)
|
||||
|
||||
@@ -5,24 +5,17 @@
|
||||
[ext_resource type="Script" uid="uid://bpnlg41p6hsel" path="res://BaseCard/margin_container.gd" id="3_j30jg"]
|
||||
[ext_resource type="Texture2D" uid="uid://dpd4hnlfynh0i" path="res://assets/icons/Cursor_projectile_symbol.png" id="4_op1lx"]
|
||||
|
||||
[node name="Card" type="AspectRatioContainer"]
|
||||
anchors_preset = -1
|
||||
anchor_left = 0.156
|
||||
anchor_top = 0.81200004
|
||||
anchor_right = 0.156
|
||||
anchor_bottom = 0.81200004
|
||||
offset_left = -249.6
|
||||
offset_top = -730.80005
|
||||
offset_right = 180.4
|
||||
offset_bottom = -49.80005
|
||||
ratio = 0.64
|
||||
stretch_mode = 0
|
||||
[node name="Card" type="PanelContainer"]
|
||||
offset_right = 430.0
|
||||
offset_bottom = 681.0
|
||||
size_flags_horizontal = 0
|
||||
size_flags_vertical = 0
|
||||
script = ExtResource("1_hoajl")
|
||||
metadata/_edit_use_anchors_ = true
|
||||
|
||||
[node name="Behaviors" type="Node" parent="."]
|
||||
|
||||
[node name="NinePatchRect" type="NinePatchRect" parent="."]
|
||||
custom_minimum_size = Vector2(400, 650)
|
||||
layout_mode = 2
|
||||
texture = ExtResource("2_111jl")
|
||||
patch_margin_left = 49
|
||||
|
||||
@@ -5,6 +5,8 @@
|
||||
[ext_resource type="Texture2D" uid="uid://dpd4hnlfynh0i" path="res://assets/icons/Cursor_projectile_symbol.png" id="3_rrs0u"]
|
||||
|
||||
[node name="Card" instance=ExtResource("1_3qnhj")]
|
||||
offset_right = 400.0
|
||||
offset_bottom = 650.0
|
||||
behaviors = [ExtResource("2_rrs0u")]
|
||||
art = ExtResource("3_rrs0u")
|
||||
title = "Cursor"
|
||||
|
||||
@@ -35,7 +35,7 @@ func _process(delta):
|
||||
cycle_card(1);
|
||||
|
||||
func play_card():
|
||||
var slots = $HBoxContainer.get_children()
|
||||
var slots = get_children()
|
||||
if active_card_index >= 0 and active_card_index < slots.size():
|
||||
var card = slots[active_card_index].get_node("Card")
|
||||
card.activate(get_node(world), get_node(player));
|
||||
@@ -54,11 +54,26 @@ func discard():
|
||||
draw_card();
|
||||
|
||||
func cycle_card(index_shift):
|
||||
#if hand.size() > 0:
|
||||
#active_card_index = (active_card_index + index_shift) % hand.size();
|
||||
#else:
|
||||
#draw_card();
|
||||
pass
|
||||
active_card_index = (active_card_index + index_shift) % 3
|
||||
set_active(active_card_index)
|
||||
|
||||
func set_active(n):
|
||||
for i in range(2):
|
||||
set_inactive((n + i + 1) % 3)
|
||||
var slot = get_slot(n)
|
||||
slot.set_z_index(1)
|
||||
var tween := create_tween()
|
||||
tween.tween_property(slot, "scale", Vector2(1.15, 1.15), 0.17)
|
||||
|
||||
func set_inactive(n):
|
||||
var slot = get_slot(n)
|
||||
slot.set_z_index(0)
|
||||
var tween := create_tween()
|
||||
tween.tween_property(slot, "scale", Vector2(1, 1), 0.2)
|
||||
|
||||
func get_slot(n):
|
||||
return get_children()[n]
|
||||
|
||||
|
||||
func draw_card():
|
||||
if drawpile.size() == 0:
|
||||
|
||||
@@ -10,44 +10,88 @@ anchor_left = 0.5
|
||||
anchor_top = 1.0
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 1.0
|
||||
offset_left = -20.0
|
||||
offset_top = -40.0
|
||||
offset_right = 20.0
|
||||
offset_left = -17.0
|
||||
offset_top = 246.0
|
||||
offset_right = -17.0
|
||||
offset_bottom = 246.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 0
|
||||
scale = Vector2(0.255, 0.255)
|
||||
scale = Vector2(0.675, 0.675)
|
||||
size_flags_vertical = 8
|
||||
script = ExtResource("1_u4p2i")
|
||||
player = NodePath("../../Player")
|
||||
world = NodePath("../..")
|
||||
metadata/_edit_use_anchors_ = true
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="."]
|
||||
[node name="Slot1" type="PanelContainer" parent="."]
|
||||
layout_mode = 1
|
||||
anchors_preset = 7
|
||||
anchor_left = 0.5
|
||||
anchor_top = 1.0
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 1.0
|
||||
offset_left = -604.0
|
||||
offset_top = -484.0
|
||||
offset_right = 604.0
|
||||
offset_left = -452.0
|
||||
offset_top = -649.0
|
||||
offset_right = -52.0
|
||||
offset_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 0
|
||||
rotation = -0.12237942
|
||||
pivot_offset = Vector2(200, 650)
|
||||
size_flags_horizontal = 0
|
||||
size_flags_vertical = 8
|
||||
metadata/_edit_group_ = true
|
||||
|
||||
[node name="Slot1" type="PanelContainer" parent="HBoxContainer"]
|
||||
[node name="Card" parent="Slot1" instance=ExtResource("2_bfasp")]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 1
|
||||
size_flags_vertical = 1
|
||||
metadata/_edit_use_anchors_ = true
|
||||
|
||||
[node name="Card" parent="HBoxContainer/Slot1" instance=ExtResource("2_bfasp")]
|
||||
layout_mode = 2
|
||||
[node name="Slot2" type="PanelContainer" parent="."]
|
||||
layout_mode = 1
|
||||
anchors_preset = 7
|
||||
anchor_left = 0.5
|
||||
anchor_top = 1.0
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 1.0
|
||||
offset_left = -144.0
|
||||
offset_top = -666.0
|
||||
offset_right = 256.0
|
||||
offset_bottom = -16.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 0
|
||||
pivot_offset = Vector2(200, 650)
|
||||
size_flags_horizontal = 0
|
||||
size_flags_vertical = 0
|
||||
metadata/_edit_group_ = true
|
||||
|
||||
[node name="Slot2" type="PanelContainer" parent="HBoxContainer"]
|
||||
[node name="Card" parent="Slot2" instance=ExtResource("2_bfasp")]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 1
|
||||
size_flags_vertical = 1
|
||||
metadata/_edit_use_anchors_ = true
|
||||
|
||||
[node name="Card" parent="HBoxContainer/Slot2" instance=ExtResource("2_bfasp")]
|
||||
layout_mode = 2
|
||||
[node name="Slot3" type="PanelContainer" parent="."]
|
||||
layout_mode = 1
|
||||
anchors_preset = 7
|
||||
anchor_left = 0.5
|
||||
anchor_top = 1.0
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 1.0
|
||||
offset_left = 130.99997
|
||||
offset_top = -641.99994
|
||||
offset_right = 531.0
|
||||
offset_bottom = 8.000061
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 0
|
||||
rotation = 0.17742148
|
||||
pivot_offset = Vector2(200, 650)
|
||||
size_flags_horizontal = 0
|
||||
size_flags_vertical = 0
|
||||
metadata/_edit_group_ = true
|
||||
|
||||
[node name="Slot3" type="PanelContainer" parent="HBoxContainer"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Card" parent="HBoxContainer/Slot3" instance=ExtResource("2_bfasp")]
|
||||
[node name="Card" parent="Slot3" instance=ExtResource("2_bfasp")]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 1
|
||||
size_flags_vertical = 1
|
||||
metadata/_edit_use_anchors_ = true
|
||||
|
||||
@@ -71,6 +71,7 @@ func dash():
|
||||
|
||||
hand.discard(self); # Must set move_state at start and end of dash
|
||||
dash_on_cooldown = true;
|
||||
|
||||
|
||||
func draw_card():
|
||||
#if drawpile.size() == 0:
|
||||
|
||||
Reference in New Issue
Block a user