diff --git a/addons/card-framework/card_factory.tscn b/addons/card-framework/card_factory.tscn index ccb821e..724593a 100644 --- a/addons/card-framework/card_factory.tscn +++ b/addons/card-framework/card_factory.tscn @@ -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="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") default_card_scene = ExtResource("2_1mca4") +back_image = ExtResource("3_1mca4") diff --git a/cards/images/Back.png b/cards/images/Back.png new file mode 100644 index 0000000..5e2c333 Binary files /dev/null and b/cards/images/Back.png differ diff --git a/cards/images/Back.png.import b/cards/images/Back.png.import new file mode 100644 index 0000000..8f50680 --- /dev/null +++ b/cards/images/Back.png.import @@ -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 diff --git a/scenes/schematic.tscn b/scenes/schematic.tscn index ae66bfa..9002358 100644 --- a/scenes/schematic.tscn +++ b/scenes/schematic.tscn @@ -80,10 +80,10 @@ metadata/_custom_type_script = "uid://6ams8uvg43gu" [node name="Team1Stiche" type="Control" parent="CardManager" unique_id=740577652] anchors_preset = 0 -offset_left = 790.0 -offset_top = 880.0 -offset_right = 790.0 -offset_bottom = 880.0 +offset_left = 405.0 +offset_top = 435.0 +offset_right = 405.0 +offset_bottom = 435.0 script = ExtResource("7_rwigh") card_face_up = false sensor_texture = SubResource("CanvasTexture_unpya") @@ -114,10 +114,10 @@ metadata/_custom_type_script = "uid://6ams8uvg43gu" [node name="Team2Stiche" type="Control" parent="CardManager" unique_id=561191290] anchors_preset = 0 -offset_left = 980.0 -offset_top = -10.0 -offset_right = 980.0 -offset_bottom = -10.0 +offset_left = 1365.0 +offset_top = 435.0 +offset_right = 1365.0 +offset_bottom = 435.0 script = ExtResource("7_rwigh") card_face_up = false allow_card_movement = false diff --git a/scripts/schematic_setup.gd b/scripts/schematic_setup.gd index 2fc9f1e..f02420f 100644 --- a/scripts/schematic_setup.gd +++ b/scripts/schematic_setup.gd @@ -10,9 +10,12 @@ extends Node2D @onready var player_3_pile = $CardManager/Player3PlayPile @onready var player_4_hand = $CardManager/Player4Hand @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 first_player = $CardManager/Player1PlayPile var trump : String +var rounds_played: int signal dealt @@ -62,6 +65,10 @@ func define_trump(suit : String): turn(first_player) func turn(first): + rounds_played += 1 + if rounds_played == 10: + count_points() + return first.sensor_visibility = true first.enable_drop_zone = true first._redraw_drop_zone() @@ -188,7 +195,8 @@ func turn(first): player_3_hand.allow_movement = false get_turn_winner() - +func count_points(): + print("end of round") func get_turn_winner(): @@ -213,10 +221,44 @@ func get_turn_winner(): print(cards[card]["value"]) elif trump == "Down": for card in cards: - cards[card]["value"] = cards[card]["value"]*-1 + cards[card]["value"] = cards[card]["value"] * (-1) print(cards[card]["value"]) + + var played_suit = first_player.get_top_cards(1)[0].card_info.suit + var highest_card: int + var highest_value: int + for i in cards: + var card = cards[i] + if card["suit"] == played_suit and card["value"] > highest_value: + highest_value = card["value"] + highest_card = i + + 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): - 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(): var suits = ["Club", "Diamond", "Heart", "Spade"]