Compare commits
5 Commits
4a05d2f4bd
..
main
| Author | SHA1 | Date | |
|---|---|---|---|
| ed22000186 | |||
| e3e60845d6 | |||
| d45b1b3617 | |||
| e78466c44a | |||
| 1958e1defd |
@@ -1,8 +1,10 @@
|
|||||||
[gd_scene load_steps=3 format=3 uid="uid://7qcsutlss3oj"]
|
[gd_scene format=3 uid="uid://7qcsutlss3oj"]
|
||||||
|
|
||||||
[ext_resource type="Script" uid="uid://8n36yadkvxai" path="res://addons/card-framework/json_card_factory.gd" id="1_jlwb4"]
|
[ext_resource type="Script" uid="uid://8n36yadkvxai" path="res://addons/card-framework/json_card_factory.gd" id="1_jlwb4"]
|
||||||
[ext_resource type="PackedScene" uid="uid://brjlo8xing83p" path="res://addons/card-framework/card.tscn" id="2_1mca4"]
|
[ext_resource type="PackedScene" uid="uid://brjlo8xing83p" path="res://addons/card-framework/card.tscn" id="2_1mca4"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://c1x31m6sr2jkr" path="res://cards/images/cardBack_blue5.png" id="3_1mca4"]
|
||||||
|
|
||||||
[node name="CardFactory" type="Node"]
|
[node name="CardFactory" type="Node" unique_id=1183620316]
|
||||||
script = ExtResource("1_jlwb4")
|
script = ExtResource("1_jlwb4")
|
||||||
default_card_scene = ExtResource("2_1mca4")
|
default_card_scene = ExtResource("2_1mca4")
|
||||||
|
back_image = ExtResource("3_1mca4")
|
||||||
|
|||||||
@@ -48,6 +48,8 @@ extends CardContainer
|
|||||||
@export var align_drop_zone_size_with_current_hand_size := true
|
@export var align_drop_zone_size_with_current_hand_size := true
|
||||||
## If true, only swap the positions of two cards when reordering (a <-> b), otherwise shift the range (default behavior).
|
## If true, only swap the positions of two cards when reordering (a <-> b), otherwise shift the range (default behavior).
|
||||||
@export var swap_only_on_reorder := false
|
@export var swap_only_on_reorder := false
|
||||||
|
## If false undoes any card movement to and from this Hand
|
||||||
|
@export var allow_movement = true
|
||||||
|
|
||||||
|
|
||||||
var vertical_partitions_from_outside = []
|
var vertical_partitions_from_outside = []
|
||||||
@@ -88,26 +90,28 @@ func compare_cards(a,b):
|
|||||||
var suit_1 = a.card_info["suit"]
|
var suit_1 = a.card_info["suit"]
|
||||||
var suit_2 = b.card_info["suit"]
|
var suit_2 = b.card_info["suit"]
|
||||||
match suit_1:
|
match suit_1:
|
||||||
"Diampnd":
|
"Diamond":
|
||||||
val_1 -= 10
|
|
||||||
"Spade":
|
|
||||||
val_1 -= 20
|
val_1 -= 20
|
||||||
|
"Spade":
|
||||||
|
val_1 -= 40
|
||||||
"Heart":
|
"Heart":
|
||||||
val_1 -= 30
|
val_1 -= 60
|
||||||
#print(val_1,su_1)
|
#print(val_1,su_1)
|
||||||
|
|
||||||
match suit_2:
|
match suit_2:
|
||||||
"Diamond":
|
"Diamond":
|
||||||
val_2 -= 10
|
|
||||||
"Spade":
|
|
||||||
val_2 -= 20
|
val_2 -= 20
|
||||||
|
"Spade":
|
||||||
|
val_2 -= 40
|
||||||
"Heart":
|
"Heart":
|
||||||
val_2 -= 30
|
val_2 -= 60
|
||||||
#print(val_2,su_2)
|
#print(val_2,su_2)
|
||||||
return val_1 < val_2
|
return val_1 < val_2
|
||||||
|
|
||||||
|
|
||||||
func _card_can_be_added(_cards: Array) -> bool:
|
func _card_can_be_added(_cards: Array) -> bool:
|
||||||
|
if not allow_movement:
|
||||||
|
return false
|
||||||
var is_all_cards_contained = true
|
var is_all_cards_contained = true
|
||||||
for i in range(_cards.size()):
|
for i in range(_cards.size()):
|
||||||
var card = _cards[i]
|
var card = _cards[i]
|
||||||
@@ -121,6 +125,7 @@ func _card_can_be_added(_cards: Array) -> bool:
|
|||||||
return _held_cards.size() + card_size <= max_hand_size
|
return _held_cards.size() + card_size <= max_hand_size
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
func _update_target_z_index() -> void:
|
func _update_target_z_index() -> void:
|
||||||
for i in range(_held_cards.size()):
|
for i in range(_held_cards.size()):
|
||||||
var card = _held_cards[i]
|
var card = _held_cards[i]
|
||||||
|
|||||||
Binary file not shown.
|
After Width: | Height: | Size: 921 B |
@@ -0,0 +1,40 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://bxkq0tqgdiy61"
|
||||||
|
path="res://.godot/imported/Back.png-08c77167688145adba4bb21ec59b3650.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://cards/images/Back.png"
|
||||||
|
dest_files=["res://.godot/imported/Back.png-08c77167688145adba4bb21ec59b3650.ctex"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
compress/mode=0
|
||||||
|
compress/high_quality=false
|
||||||
|
compress/lossy_quality=0.7
|
||||||
|
compress/uastc_level=0
|
||||||
|
compress/rdo_quality_loss=0.0
|
||||||
|
compress/hdr_compression=1
|
||||||
|
compress/normal_map=0
|
||||||
|
compress/channel_pack=0
|
||||||
|
mipmaps/generate=false
|
||||||
|
mipmaps/limit=-1
|
||||||
|
roughness/mode=0
|
||||||
|
roughness/src_normal=""
|
||||||
|
process/channel_remap/red=0
|
||||||
|
process/channel_remap/green=1
|
||||||
|
process/channel_remap/blue=2
|
||||||
|
process/channel_remap/alpha=3
|
||||||
|
process/fix_alpha_border=true
|
||||||
|
process/premult_alpha=false
|
||||||
|
process/normal_map_invert_y=false
|
||||||
|
process/hdr_as_srgb=false
|
||||||
|
process/hdr_clamp_exposure=false
|
||||||
|
process/size_limit=0
|
||||||
|
detect_3d/compress_to=1
|
||||||
+39
-19
@@ -16,6 +16,8 @@
|
|||||||
[ext_resource type="Texture2D" uid="uid://7qs010wi55mj" path="res://cards/images/cardSpadesJ.png" id="13_vsw8n"]
|
[ext_resource type="Texture2D" uid="uid://7qs010wi55mj" path="res://cards/images/cardSpadesJ.png" id="13_vsw8n"]
|
||||||
[ext_resource type="Texture2D" uid="uid://dvqxm048cpqso" path="res://cards/images/cardDiamondsJ.png" id="14_el68r"]
|
[ext_resource type="Texture2D" uid="uid://dvqxm048cpqso" path="res://cards/images/cardDiamondsJ.png" id="14_el68r"]
|
||||||
[ext_resource type="Texture2D" uid="uid://d0fi2w3eqskmy" path="res://cards/images/cardClubsJ.png" id="15_ir868"]
|
[ext_resource type="Texture2D" uid="uid://d0fi2w3eqskmy" path="res://cards/images/cardClubsJ.png" id="15_ir868"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://pflyomkxrjws" path="res://cards/images/cardHeartsA.png" id="15_wiovv"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://dvjbl3cdjlxte" path="res://cards/images/cardClubs6.png" id="18_32sqw"]
|
||||||
|
|
||||||
[sub_resource type="CanvasTexture" id="CanvasTexture_unpya"]
|
[sub_resource type="CanvasTexture" id="CanvasTexture_unpya"]
|
||||||
diffuse_texture = ExtResource("9_ggwjq")
|
diffuse_texture = ExtResource("9_ggwjq")
|
||||||
@@ -71,17 +73,21 @@ offset_top = 560.0
|
|||||||
offset_right = 790.0
|
offset_right = 790.0
|
||||||
offset_bottom = 560.0
|
offset_bottom = 560.0
|
||||||
script = ExtResource("7_rwigh")
|
script = ExtResource("7_rwigh")
|
||||||
|
enable_drop_zone = false
|
||||||
sensor_texture = ExtResource("9_ggwjq")
|
sensor_texture = ExtResource("9_ggwjq")
|
||||||
|
sensor_visibility = true
|
||||||
metadata/_custom_type_script = "uid://6ams8uvg43gu"
|
metadata/_custom_type_script = "uid://6ams8uvg43gu"
|
||||||
|
|
||||||
[node name="Team1Stiche" type="Control" parent="CardManager" unique_id=740577652]
|
[node name="Team1Stiche" type="Control" parent="CardManager" unique_id=740577652]
|
||||||
anchors_preset = 0
|
anchors_preset = 0
|
||||||
offset_left = 790.0
|
offset_left = 405.0
|
||||||
offset_top = 880.0
|
offset_top = 435.0
|
||||||
offset_right = 790.0
|
offset_right = 405.0
|
||||||
offset_bottom = 880.0
|
offset_bottom = 435.0
|
||||||
script = ExtResource("7_rwigh")
|
script = ExtResource("7_rwigh")
|
||||||
card_face_up = false
|
card_face_up = false
|
||||||
|
allow_card_movement = false
|
||||||
|
enable_drop_zone = false
|
||||||
sensor_texture = SubResource("CanvasTexture_unpya")
|
sensor_texture = SubResource("CanvasTexture_unpya")
|
||||||
metadata/_custom_type_script = "uid://6ams8uvg43gu"
|
metadata/_custom_type_script = "uid://6ams8uvg43gu"
|
||||||
|
|
||||||
@@ -93,7 +99,6 @@ offset_top = 880.0
|
|||||||
offset_right = 1440.0
|
offset_right = 1440.0
|
||||||
offset_bottom = 880.0
|
offset_bottom = 880.0
|
||||||
script = ExtResource("4_unpya")
|
script = ExtResource("4_unpya")
|
||||||
card_face_up = false
|
|
||||||
hand_rotation_curve = ExtResource("5_kdjyk")
|
hand_rotation_curve = ExtResource("5_kdjyk")
|
||||||
hand_vertical_curve = ExtResource("6_ikr1a")
|
hand_vertical_curve = ExtResource("6_ikr1a")
|
||||||
metadata/_custom_type_script = "uid://dj46jo3lfbclo"
|
metadata/_custom_type_script = "uid://dj46jo3lfbclo"
|
||||||
@@ -105,17 +110,19 @@ offset_top = 560.0
|
|||||||
offset_right = 980.0
|
offset_right = 980.0
|
||||||
offset_bottom = 560.0
|
offset_bottom = 560.0
|
||||||
script = ExtResource("7_rwigh")
|
script = ExtResource("7_rwigh")
|
||||||
|
enable_drop_zone = false
|
||||||
sensor_texture = SubResource("CanvasTexture_kdjyk")
|
sensor_texture = SubResource("CanvasTexture_kdjyk")
|
||||||
metadata/_custom_type_script = "uid://6ams8uvg43gu"
|
metadata/_custom_type_script = "uid://6ams8uvg43gu"
|
||||||
|
|
||||||
[node name="Team2Stiche" type="Control" parent="CardManager" unique_id=561191290]
|
[node name="Team2Stiche" type="Control" parent="CardManager" unique_id=561191290]
|
||||||
anchors_preset = 0
|
anchors_preset = 0
|
||||||
offset_left = 980.0
|
offset_left = 1365.0
|
||||||
offset_top = -10.0
|
offset_top = 435.0
|
||||||
offset_right = 980.0
|
offset_right = 1365.0
|
||||||
offset_bottom = -10.0
|
offset_bottom = 435.0
|
||||||
script = ExtResource("7_rwigh")
|
script = ExtResource("7_rwigh")
|
||||||
card_face_up = false
|
card_face_up = false
|
||||||
|
enable_drop_zone = false
|
||||||
metadata/_custom_type_script = "uid://6ams8uvg43gu"
|
metadata/_custom_type_script = "uid://6ams8uvg43gu"
|
||||||
|
|
||||||
[node name="Player3Hand" type="Control" parent="CardManager" unique_id=1841661362]
|
[node name="Player3Hand" type="Control" parent="CardManager" unique_id=1841661362]
|
||||||
@@ -125,7 +132,6 @@ offset_top = -10.0
|
|||||||
offset_right = 1440.0
|
offset_right = 1440.0
|
||||||
offset_bottom = -10.0
|
offset_bottom = -10.0
|
||||||
script = ExtResource("4_unpya")
|
script = ExtResource("4_unpya")
|
||||||
card_face_up = false
|
|
||||||
hand_rotation_curve = ExtResource("10_kdjyk")
|
hand_rotation_curve = ExtResource("10_kdjyk")
|
||||||
hand_vertical_curve = ExtResource("10_unpya")
|
hand_vertical_curve = ExtResource("10_unpya")
|
||||||
metadata/_custom_type_script = "uid://dj46jo3lfbclo"
|
metadata/_custom_type_script = "uid://dj46jo3lfbclo"
|
||||||
@@ -149,10 +155,10 @@ offset_top = -10.0
|
|||||||
offset_right = 480.0
|
offset_right = 480.0
|
||||||
offset_bottom = -10.0
|
offset_bottom = -10.0
|
||||||
script = ExtResource("4_unpya")
|
script = ExtResource("4_unpya")
|
||||||
card_face_up = false
|
|
||||||
card_hover_distance = 0.0
|
card_hover_distance = 0.0
|
||||||
hand_rotation_curve = ExtResource("10_kdjyk")
|
hand_rotation_curve = ExtResource("10_kdjyk")
|
||||||
hand_vertical_curve = ExtResource("10_unpya")
|
hand_vertical_curve = ExtResource("10_unpya")
|
||||||
|
allow_movement = false
|
||||||
metadata/_custom_type_script = "uid://dj46jo3lfbclo"
|
metadata/_custom_type_script = "uid://dj46jo3lfbclo"
|
||||||
|
|
||||||
[node name="Player4PlayPile" type="Control" parent="CardManager" unique_id=1625790580]
|
[node name="Player4PlayPile" type="Control" parent="CardManager" unique_id=1625790580]
|
||||||
@@ -187,11 +193,11 @@ vertical_alignment = 1
|
|||||||
[node name="GridContainer" type="GridContainer" parent="ButtonsTrumpSelect" unique_id=412936036]
|
[node name="GridContainer" type="GridContainer" parent="ButtonsTrumpSelect" unique_id=412936036]
|
||||||
z_index = 10
|
z_index = 10
|
||||||
layout_mode = 0
|
layout_mode = 0
|
||||||
offset_left = 810.0
|
offset_left = 754.0
|
||||||
offset_top = 340.0
|
offset_top = 340.0
|
||||||
offset_right = 1110.0
|
offset_right = 1206.0
|
||||||
offset_bottom = 740.0
|
offset_bottom = 740.0
|
||||||
columns = 2
|
columns = 3
|
||||||
metadata/_edit_group_ = true
|
metadata/_edit_group_ = true
|
||||||
|
|
||||||
[node name="ButtonHeart" type="Button" parent="ButtonsTrumpSelect/GridContainer" unique_id=1595325767]
|
[node name="ButtonHeart" type="Button" parent="ButtonsTrumpSelect/GridContainer" unique_id=1595325767]
|
||||||
@@ -202,23 +208,37 @@ icon = ExtResource("12_gwibp")
|
|||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
icon = ExtResource("13_vsw8n")
|
icon = ExtResource("13_vsw8n")
|
||||||
|
|
||||||
[node name="ButtonDiamond" type="Button" parent="ButtonsTrumpSelect/GridContainer" unique_id=838232450]
|
[node name="ButtonTopDown" type="Button" parent="ButtonsTrumpSelect/GridContainer" unique_id=1650061945]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
icon = ExtResource("14_el68r")
|
icon = ExtResource("15_wiovv")
|
||||||
|
|
||||||
[node name="ButtonClub" type="Button" parent="ButtonsTrumpSelect/GridContainer" unique_id=677142745]
|
[node name="ButtonClub" type="Button" parent="ButtonsTrumpSelect/GridContainer" unique_id=677142745]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
icon = ExtResource("15_ir868")
|
icon = ExtResource("15_ir868")
|
||||||
|
|
||||||
|
[node name="ButtonDiamond" type="Button" parent="ButtonsTrumpSelect/GridContainer" unique_id=838232450]
|
||||||
|
layout_mode = 2
|
||||||
|
icon = ExtResource("14_el68r")
|
||||||
|
|
||||||
|
[node name="ButtonDownUp" type="Button" parent="ButtonsTrumpSelect/GridContainer" unique_id=1031871977]
|
||||||
|
layout_mode = 2
|
||||||
|
icon = ExtResource("18_32sqw")
|
||||||
|
|
||||||
[connection signal="mouse_entered" from="ButtonsTrumpSelect/GridContainer/ButtonHeart" to="ButtonsTrumpSelect" method="_on_button_heart_mouse_entered"]
|
[connection signal="mouse_entered" from="ButtonsTrumpSelect/GridContainer/ButtonHeart" to="ButtonsTrumpSelect" method="_on_button_heart_mouse_entered"]
|
||||||
[connection signal="mouse_exited" from="ButtonsTrumpSelect/GridContainer/ButtonHeart" to="ButtonsTrumpSelect" method="_on_button_heart_mouse_exited"]
|
[connection signal="mouse_exited" from="ButtonsTrumpSelect/GridContainer/ButtonHeart" to="ButtonsTrumpSelect" method="_on_button_heart_mouse_exited"]
|
||||||
[connection signal="pressed" from="ButtonsTrumpSelect/GridContainer/ButtonHeart" to="ButtonsTrumpSelect" method="_on_button_heart_pressed"]
|
[connection signal="pressed" from="ButtonsTrumpSelect/GridContainer/ButtonHeart" to="ButtonsTrumpSelect" method="_on_button_heart_pressed"]
|
||||||
[connection signal="mouse_entered" from="ButtonsTrumpSelect/GridContainer/ButtonSpade" to="ButtonsTrumpSelect" method="_on_button_spade_mouse_entered"]
|
[connection signal="mouse_entered" from="ButtonsTrumpSelect/GridContainer/ButtonSpade" to="ButtonsTrumpSelect" method="_on_button_spade_mouse_entered"]
|
||||||
[connection signal="mouse_exited" from="ButtonsTrumpSelect/GridContainer/ButtonSpade" to="ButtonsTrumpSelect" method="_on_button_spade_mouse_exited"]
|
[connection signal="mouse_exited" from="ButtonsTrumpSelect/GridContainer/ButtonSpade" to="ButtonsTrumpSelect" method="_on_button_spade_mouse_exited"]
|
||||||
[connection signal="pressed" from="ButtonsTrumpSelect/GridContainer/ButtonSpade" to="ButtonsTrumpSelect" method="_on_button_spade_pressed"]
|
[connection signal="pressed" from="ButtonsTrumpSelect/GridContainer/ButtonSpade" to="ButtonsTrumpSelect" method="_on_button_spade_pressed"]
|
||||||
[connection signal="mouse_entered" from="ButtonsTrumpSelect/GridContainer/ButtonDiamond" to="ButtonsTrumpSelect" method="_on_button_diamond_mouse_entered"]
|
[connection signal="mouse_entered" from="ButtonsTrumpSelect/GridContainer/ButtonTopDown" to="ButtonsTrumpSelect" method="_on_button_top_down_mouse_entered"]
|
||||||
[connection signal="mouse_exited" from="ButtonsTrumpSelect/GridContainer/ButtonDiamond" to="ButtonsTrumpSelect" method="_on_button_diamond_mouse_exited"]
|
[connection signal="mouse_exited" from="ButtonsTrumpSelect/GridContainer/ButtonTopDown" to="ButtonsTrumpSelect" method="_on_button_top_down_mouse_exited"]
|
||||||
[connection signal="pressed" from="ButtonsTrumpSelect/GridContainer/ButtonDiamond" to="ButtonsTrumpSelect" method="_on_button_diamond_pressed"]
|
[connection signal="pressed" from="ButtonsTrumpSelect/GridContainer/ButtonTopDown" to="ButtonsTrumpSelect" method="_on_button_top_down_pressed"]
|
||||||
[connection signal="mouse_entered" from="ButtonsTrumpSelect/GridContainer/ButtonClub" to="ButtonsTrumpSelect" method="_on_button_club_mouse_entered"]
|
[connection signal="mouse_entered" from="ButtonsTrumpSelect/GridContainer/ButtonClub" to="ButtonsTrumpSelect" method="_on_button_club_mouse_entered"]
|
||||||
[connection signal="mouse_exited" from="ButtonsTrumpSelect/GridContainer/ButtonClub" to="ButtonsTrumpSelect" method="_on_button_club_mouse_exited"]
|
[connection signal="mouse_exited" from="ButtonsTrumpSelect/GridContainer/ButtonClub" to="ButtonsTrumpSelect" method="_on_button_club_mouse_exited"]
|
||||||
[connection signal="pressed" from="ButtonsTrumpSelect/GridContainer/ButtonClub" to="ButtonsTrumpSelect" method="_on_button_club_pressed"]
|
[connection signal="pressed" from="ButtonsTrumpSelect/GridContainer/ButtonClub" to="ButtonsTrumpSelect" method="_on_button_club_pressed"]
|
||||||
|
[connection signal="mouse_entered" from="ButtonsTrumpSelect/GridContainer/ButtonDiamond" to="ButtonsTrumpSelect" method="_on_button_diamond_mouse_entered"]
|
||||||
|
[connection signal="mouse_exited" from="ButtonsTrumpSelect/GridContainer/ButtonDiamond" to="ButtonsTrumpSelect" method="_on_button_diamond_mouse_exited"]
|
||||||
|
[connection signal="pressed" from="ButtonsTrumpSelect/GridContainer/ButtonDiamond" to="ButtonsTrumpSelect" method="_on_button_diamond_pressed"]
|
||||||
|
[connection signal="mouse_entered" from="ButtonsTrumpSelect/GridContainer/ButtonDownUp" to="ButtonsTrumpSelect" method="_on_button_down_up_mouse_entered"]
|
||||||
|
[connection signal="mouse_exited" from="ButtonsTrumpSelect/GridContainer/ButtonDownUp" to="ButtonsTrumpSelect" method="_on_button_down_up_mouse_exited"]
|
||||||
|
[connection signal="pressed" from="ButtonsTrumpSelect/GridContainer/ButtonDownUp" to="ButtonsTrumpSelect" method="_on_button_down_up_pressed"]
|
||||||
|
|||||||
@@ -30,6 +30,15 @@ func _on_button_club_mouse_entered() -> void:
|
|||||||
func _on_button_club_mouse_exited() -> void:
|
func _on_button_club_mouse_exited() -> void:
|
||||||
label.text = "Choose Trump"
|
label.text = "Choose Trump"
|
||||||
|
|
||||||
|
func _on_button_top_down_mouse_entered() -> void:
|
||||||
|
label.text = "Top Down"
|
||||||
|
func _on_button_top_down_mouse_exited() -> void:
|
||||||
|
label.text = "Choose Trump"
|
||||||
|
|
||||||
|
func _on_button_down_up_mouse_entered() -> void:
|
||||||
|
label.text = "Down Up"
|
||||||
|
func _on_button_down_up_mouse_exited() -> void:
|
||||||
|
label.text = "Choose Trump"
|
||||||
|
|
||||||
func _on_button_heart_pressed() -> void:
|
func _on_button_heart_pressed() -> void:
|
||||||
trump.emit("Heart")
|
trump.emit("Heart")
|
||||||
@@ -43,3 +52,9 @@ func _on_button_diamond_pressed() -> void:
|
|||||||
func _on_button_club_pressed() -> void:
|
func _on_button_club_pressed() -> void:
|
||||||
trump.emit("Club")
|
trump.emit("Club")
|
||||||
self.visible = false
|
self.visible = false
|
||||||
|
func _on_button_top_down_pressed() -> void:
|
||||||
|
trump.emit("Top")
|
||||||
|
self.visible = false
|
||||||
|
func _on_button_down_up_pressed() -> void:
|
||||||
|
trump.emit("Down")
|
||||||
|
self.visible = false
|
||||||
|
|||||||
@@ -0,0 +1,5 @@
|
|||||||
|
extends Resource
|
||||||
|
class_name Points
|
||||||
|
|
||||||
|
var team_1_points
|
||||||
|
var team_2_points
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
uid://dwabqnrusgyob
|
||||||
+153
-117
@@ -10,12 +10,18 @@ extends Node2D
|
|||||||
@onready var player_3_pile = $CardManager/Player3PlayPile
|
@onready var player_3_pile = $CardManager/Player3PlayPile
|
||||||
@onready var player_4_hand = $CardManager/Player4Hand
|
@onready var player_4_hand = $CardManager/Player4Hand
|
||||||
@onready var player_4_pile = $CardManager/Player4PlayPile
|
@onready var player_4_pile = $CardManager/Player4PlayPile
|
||||||
|
@onready var team_1_stiche = $CardManager/Team1Stiche
|
||||||
|
@onready var team_2_stiche = $CardManager/Team2Stiche
|
||||||
@onready var trumpbuttons = $ButtonsTrumpSelect
|
@onready var trumpbuttons = $ButtonsTrumpSelect
|
||||||
@onready var first_player = $CardManager/Player1PlayPile
|
@onready var first_player = $CardManager/Player1PlayPile
|
||||||
var trump : String
|
var trump : String
|
||||||
|
var rounds_played : int
|
||||||
|
var team_1_points :int = 0
|
||||||
|
var team_2_points :int = 0
|
||||||
|
|
||||||
|
const DEAL_PAUSE = 0.5
|
||||||
|
|
||||||
signal dealt
|
signal dealt
|
||||||
|
|
||||||
func _ready():
|
func _ready():
|
||||||
trumpbuttons.trump.connect(define_trump.bind())
|
trumpbuttons.trump.connect(define_trump.bind())
|
||||||
player_1_pile.enable_drop_zone = false
|
player_1_pile.enable_drop_zone = false
|
||||||
@@ -32,8 +38,13 @@ func setup_game():
|
|||||||
create_standard_deck()
|
create_standard_deck()
|
||||||
deck._held_cards.shuffle()
|
deck._held_cards.shuffle()
|
||||||
|
|
||||||
|
player_1_hand.allow_movement = true
|
||||||
|
player_2_hand.allow_movement = true
|
||||||
|
player_3_hand.allow_movement = true
|
||||||
|
player_4_hand.allow_movement = true
|
||||||
|
|
||||||
# Deal initial hand
|
# Deal initial hand
|
||||||
const DEAL_PAUSE = 0.1
|
|
||||||
var deal_r: int =1
|
var deal_r: int =1
|
||||||
while true:
|
while true:
|
||||||
deal_cards_to_hand(3, player_1_hand)
|
deal_cards_to_hand(3, player_1_hand)
|
||||||
@@ -54,130 +65,155 @@ func setup_game():
|
|||||||
|
|
||||||
func define_trump(suit : String):
|
func define_trump(suit : String):
|
||||||
trump = suit
|
trump = suit
|
||||||
turn(first_player)
|
play_round()
|
||||||
|
|
||||||
func turn(first):
|
func play_round():
|
||||||
first.sensor_visibility = true
|
var player = first_player
|
||||||
first.enable_drop_zone = true
|
rounds_played += 1
|
||||||
first._redraw_drop_zone()
|
if rounds_played == 10:
|
||||||
await first.played
|
count_points()
|
||||||
first.enable_drop_zone = false
|
return
|
||||||
first._redraw_drop_zone()
|
var n : int = 1
|
||||||
match first:
|
while true:
|
||||||
player_1_pile:
|
await turn(player)
|
||||||
|
if n == 4:
|
||||||
player_2_pile.sensor_visibility = true
|
break
|
||||||
player_2_pile.enable_drop_zone = true
|
match player:
|
||||||
player_2_pile._redraw_drop_zone()
|
player_1_pile:
|
||||||
await player_2_pile.played
|
player = player_2_pile
|
||||||
player_2_pile.enable_drop_zone = false
|
player_2_pile:
|
||||||
player_2_pile._redraw_drop_zone()
|
player = player_3_pile
|
||||||
|
player_3_pile:
|
||||||
player_3_pile.sensor_visibility = true
|
player = player_4_pile
|
||||||
player_3_pile.enable_drop_zone = true
|
player_4_pile:
|
||||||
player_3_pile._redraw_drop_zone()
|
player = player_1_pile
|
||||||
await player_3_pile.played
|
n += 1
|
||||||
player_3_pile.enable_drop_zone = false
|
|
||||||
player_3_pile._redraw_drop_zone()
|
|
||||||
|
|
||||||
player_4_pile.sensor_visibility = true
|
|
||||||
player_4_pile.enable_drop_zone = true
|
|
||||||
player_4_pile._redraw_drop_zone()
|
|
||||||
await player_4_pile.played
|
|
||||||
player_4_pile.enable_drop_zone = false
|
|
||||||
player_4_pile._redraw_drop_zone()
|
|
||||||
|
|
||||||
player_2_pile:
|
|
||||||
|
|
||||||
player_3_pile.sensor_visibility = true
|
|
||||||
player_3_pile.enable_drop_zone = true
|
|
||||||
player_3_pile._redraw_drop_zone()
|
|
||||||
await player_3_pile.played
|
|
||||||
player_3_pile.enable_drop_zone = false
|
|
||||||
player_3_pile._redraw_drop_zone()
|
|
||||||
|
|
||||||
player_4_pile.sensor_visibility = true
|
|
||||||
player_4_pile.enable_drop_zone = true
|
|
||||||
player_4_pile._redraw_drop_zone()
|
|
||||||
await player_4_pile.played
|
|
||||||
player_4_pile.enable_drop_zone = false
|
|
||||||
player_4_pile._redraw_drop_zone()
|
|
||||||
|
|
||||||
player_1_pile.sensor_visibility = true
|
|
||||||
player_1_pile.enable_drop_zone = true
|
|
||||||
player_1_pile._redraw_drop_zone()
|
|
||||||
await player_1_pile.played
|
|
||||||
player_1_pile.enable_drop_zone = false
|
|
||||||
player_1_pile._redraw_drop_zone()
|
|
||||||
|
|
||||||
player_3_pile:
|
|
||||||
|
|
||||||
player_4_pile.sensor_visibility = true
|
|
||||||
player_4_pile.enable_drop_zone = true
|
|
||||||
player_4_pile._redraw_drop_zone()
|
|
||||||
await player_4_pile.played
|
|
||||||
player_4_pile.enable_drop_zone = false
|
|
||||||
player_4_pile._redraw_drop_zone()
|
|
||||||
|
|
||||||
player_1_pile.sensor_visibility = true
|
|
||||||
player_1_pile.enable_drop_zone = true
|
|
||||||
player_1_pile._redraw_drop_zone()
|
|
||||||
await player_1_pile.played
|
|
||||||
player_1_pile.enable_drop_zone = false
|
|
||||||
player_1_pile._redraw_drop_zone()
|
|
||||||
|
|
||||||
player_2_pile.sensor_visibility = true
|
|
||||||
player_2_pile.enable_drop_zone = true
|
|
||||||
player_2_pile._redraw_drop_zone()
|
|
||||||
await player_2_pile.played
|
|
||||||
player_2_pile.enable_drop_zone = false
|
|
||||||
player_2_pile._redraw_drop_zone()
|
|
||||||
|
|
||||||
player_4_pile:
|
|
||||||
player_1_pile.sensor_visibility = true
|
|
||||||
player_1_pile.enable_drop_zone = true
|
|
||||||
player_1_pile._redraw_drop_zone()
|
|
||||||
await player_1_pile.played
|
|
||||||
player_1_pile.enable_drop_zone = false
|
|
||||||
player_1_pile._redraw_drop_zone()
|
|
||||||
|
|
||||||
player_2_pile.sensor_visibility = true
|
|
||||||
player_2_pile.enable_drop_zone = true
|
|
||||||
player_2_pile._redraw_drop_zone()
|
|
||||||
await player_2_pile.played
|
|
||||||
player_2_pile.enable_drop_zone = false
|
|
||||||
player_2_pile._redraw_drop_zone()
|
|
||||||
|
|
||||||
player_3_pile.sensor_visibility = true
|
|
||||||
player_3_pile.enable_drop_zone = true
|
|
||||||
player_3_pile._redraw_drop_zone()
|
|
||||||
await player_3_pile.played
|
|
||||||
player_3_pile.enable_drop_zone = false
|
|
||||||
player_3_pile._redraw_drop_zone()
|
|
||||||
get_turn_winner()
|
get_turn_winner()
|
||||||
|
play_round()
|
||||||
|
|
||||||
|
func turn(player):
|
||||||
|
player.sensor_visibility = true
|
||||||
|
player.enable_drop_zone = true
|
||||||
|
player._redraw_drop_zone()
|
||||||
|
await player.played
|
||||||
|
player.enable_drop_zone = false
|
||||||
|
player._redraw_drop_zone()
|
||||||
|
|
||||||
|
|
||||||
|
func count_points():
|
||||||
|
for i in team_1_stiche._held_cards:
|
||||||
|
match i[0].card_info["value"]:
|
||||||
|
6:
|
||||||
|
if trump == "Down":
|
||||||
|
team_1_points += 11
|
||||||
|
8:
|
||||||
|
if trump == "Top" or trump == "Down":
|
||||||
|
team_1_points += 8
|
||||||
|
9:
|
||||||
|
if i.card_info.suit == trump:
|
||||||
|
team_1_points += 14
|
||||||
|
10:
|
||||||
|
team_1_points += 10
|
||||||
|
11:
|
||||||
|
if i.card_info.suit == trump:
|
||||||
|
team_1_points += 20
|
||||||
|
else:
|
||||||
|
team_1_points += 2
|
||||||
|
12:
|
||||||
|
team_1_points += 3
|
||||||
|
13:
|
||||||
|
team_1_points += 4
|
||||||
|
14:
|
||||||
|
if trump != "Down":
|
||||||
|
team_1_points += 11
|
||||||
|
print(team_1_points)
|
||||||
|
for i in team_2_stiche._held_cards:
|
||||||
|
match i.card_info["value"]:
|
||||||
|
6:
|
||||||
|
if trump == "Down":
|
||||||
|
team_2_points += 11
|
||||||
|
8:
|
||||||
|
if trump == "Top" or trump == "Down":
|
||||||
|
team_2_points += 8
|
||||||
|
9:
|
||||||
|
if i.card_info.suit == trump:
|
||||||
|
team_2_points += 14
|
||||||
|
10:
|
||||||
|
team_2_points += 10
|
||||||
|
11:
|
||||||
|
if i.card_info.suit == trump:
|
||||||
|
team_2_points += 20
|
||||||
|
else:
|
||||||
|
team_2_points += 2
|
||||||
|
12:
|
||||||
|
team_2_points += 3
|
||||||
|
13:
|
||||||
|
team_2_points += 4
|
||||||
|
14:
|
||||||
|
if trump != "Down":
|
||||||
|
team_2_points += 11
|
||||||
|
print(team_2_points)
|
||||||
|
|
||||||
func get_turn_winner():
|
func get_turn_winner():
|
||||||
var card_1 = player_1_pile.get_top_cards(1)[0]
|
var cards = {
|
||||||
var card_2 = player_2_pile.get_top_cards(1)[0]
|
1: {"value": int(player_1_pile.get_top_cards(1)[0].card_info.value), "suit": player_1_pile.get_top_cards(1)[0].card_info.suit},
|
||||||
var card_3 = player_3_pile.get_top_cards(1)[0]
|
2: {"value": int(player_2_pile.get_top_cards(1)[0].card_info.value), "suit": player_2_pile.get_top_cards(1)[0].card_info.suit},
|
||||||
var card_4 = player_4_pile.get_top_cards(1)[0]
|
3: {"value": int(player_3_pile.get_top_cards(1)[0].card_info.value), "suit": player_3_pile.get_top_cards(1)[0].card_info.suit},
|
||||||
var value_1 = card_1.card_info.value
|
4: {"value": int(player_4_pile.get_top_cards(1)[0].card_info.value), "suit": player_4_pile.get_top_cards(1)[0].card_info.suit}
|
||||||
var value_2 = card_2.card_info.value
|
}
|
||||||
var value_3 = card_3.card_info.value
|
print(trump)
|
||||||
var value_4 = card_4.card_info.value
|
if trump != "Top" and trump != "Down":
|
||||||
|
print("pass")
|
||||||
|
for card in cards:
|
||||||
|
if trump == cards[card]["suit"]:
|
||||||
|
match cards[card]["value"]:
|
||||||
|
11:
|
||||||
|
cards[card]["value"] += 80
|
||||||
|
9:
|
||||||
|
cards[card]["value"] += 50
|
||||||
|
_:
|
||||||
|
cards[card]["value"] += 20
|
||||||
|
print(cards[card]["value"])
|
||||||
|
elif trump == "Down":
|
||||||
|
for card in cards:
|
||||||
|
cards[card]["value"] = cards[card]["value"] * (-1)
|
||||||
|
print(cards[card]["value"])
|
||||||
|
|
||||||
if trump == card_1.card_info.suit:
|
var played_suit = first_player.get_top_cards(1)[0].card_info.suit
|
||||||
match value_1:
|
var highest_card: int
|
||||||
11:
|
var highest_value: int = -15
|
||||||
value_1 += 40
|
for i in cards:
|
||||||
9:
|
var card = cards[i]
|
||||||
value_1 += 30
|
if card["suit"] == played_suit and card["value"] > highest_value or card["suit"] == trump and card["value"] > highest_value:
|
||||||
|
highest_value = card["value"]
|
||||||
|
highest_card = i
|
||||||
|
await get_tree().create_timer(DEAL_PAUSE).timeout
|
||||||
|
match highest_card:
|
||||||
|
1:
|
||||||
|
first_player = player_1_pile
|
||||||
|
move_to_stiche(1)
|
||||||
|
2:
|
||||||
|
first_player = player_2_pile
|
||||||
|
move_to_stiche(2)
|
||||||
|
3:
|
||||||
|
first_player = player_3_pile
|
||||||
|
move_to_stiche(1)
|
||||||
|
4:
|
||||||
|
first_player = player_4_pile
|
||||||
|
move_to_stiche(2)
|
||||||
|
|
||||||
func move_to_stiche(team: int):
|
func move_to_stiche(team: int):
|
||||||
pass
|
if team == 1:
|
||||||
|
team_1_stiche.move_cards(player_1_pile.get_top_cards(1))
|
||||||
|
team_1_stiche.move_cards(player_2_pile.get_top_cards(1))
|
||||||
|
team_1_stiche.move_cards(player_3_pile.get_top_cards(1))
|
||||||
|
team_1_stiche.move_cards(player_4_pile.get_top_cards(1))
|
||||||
|
else:
|
||||||
|
team_2_stiche.move_cards(player_1_pile.get_top_cards(1))
|
||||||
|
team_2_stiche.move_cards(player_2_pile.get_top_cards(1))
|
||||||
|
team_2_stiche.move_cards(player_3_pile.get_top_cards(1))
|
||||||
|
team_2_stiche.move_cards(player_4_pile.get_top_cards(1))
|
||||||
|
turn(first_player)
|
||||||
|
|
||||||
func create_standard_deck():
|
func create_standard_deck():
|
||||||
var suits = ["Club", "Diamond", "Heart", "Spade"]
|
var suits = ["Club", "Diamond", "Heart", "Spade"]
|
||||||
|
|||||||
Reference in New Issue
Block a user