init
This commit is contained in:
13
scenes/Jass_card_factory.tscn
Normal file
13
scenes/Jass_card_factory.tscn
Normal file
@@ -0,0 +1,13 @@
|
||||
[gd_scene load_steps=4 format=3 uid="uid://cbjawyutvn74s"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://8n36yadkvxai" path="res://addons/card-framework/json_card_factory.gd" id="1_iftdj"]
|
||||
[ext_resource type="PackedScene" uid="uid://gyx3vifd5cc1" path="res://scenes/playing_card.tscn" id="2_4ebet"]
|
||||
[ext_resource type="Texture2D" uid="uid://c1x31m6sr2jkr" path="res://cards/images/cardBack_blue5.png" id="2_lr3ku"]
|
||||
|
||||
[node name="JsonCardFactory" type="Node"]
|
||||
script = ExtResource("1_iftdj")
|
||||
default_card_scene = ExtResource("2_4ebet")
|
||||
card_asset_dir = "res://cards/images/"
|
||||
card_info_dir = "res://cards/data/"
|
||||
back_image = ExtResource("2_lr3ku")
|
||||
metadata/_custom_type_script = "uid://8n36yadkvxai"
|
||||
32
scenes/playing_card.tscn
Normal file
32
scenes/playing_card.tscn
Normal file
@@ -0,0 +1,32 @@
|
||||
[gd_scene load_steps=2 format=3 uid="uid://gyx3vifd5cc1"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://c7ga0nn8lgmnk" path="res://scripts/playing_card.gd" id="1_jxw2m"]
|
||||
|
||||
[node name="PlayingCard" type="Control"]
|
||||
layout_mode = 3
|
||||
anchors_preset = 0
|
||||
script = ExtResource("1_jxw2m")
|
||||
|
||||
[node name="FrontFace" type="Control" parent="."]
|
||||
layout_mode = 1
|
||||
anchors_preset = 0
|
||||
offset_right = 40.0
|
||||
offset_bottom = 40.0
|
||||
mouse_filter = 1
|
||||
|
||||
[node name="TextureRect" type="TextureRect" parent="FrontFace"]
|
||||
layout_mode = 1
|
||||
offset_right = 150.0
|
||||
offset_bottom = 210.0
|
||||
|
||||
[node name="BackFace" type="Control" parent="."]
|
||||
layout_mode = 1
|
||||
anchors_preset = 0
|
||||
offset_right = 40.0
|
||||
offset_bottom = 40.0
|
||||
mouse_filter = 1
|
||||
|
||||
[node name="TextureRect" type="TextureRect" parent="BackFace"]
|
||||
layout_mode = 1
|
||||
offset_right = 150.0
|
||||
offset_bottom = 210.0
|
||||
181
scenes/schematic.tscn
Normal file
181
scenes/schematic.tscn
Normal file
@@ -0,0 +1,181 @@
|
||||
[gd_scene format=3 uid="uid://bp0i0yks8p3ly"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://87mx553o86gf" path="res://scenes/schematic_setup.gd" id="1_1j52r"]
|
||||
[ext_resource type="Script" uid="uid://clqgq1n7v0ar" path="res://addons/card-framework/card_manager.gd" id="2_waqni"]
|
||||
[ext_resource type="PackedScene" uid="uid://cbjawyutvn74s" path="res://scenes/Jass_card_factory.tscn" id="3_ggwjq"]
|
||||
[ext_resource type="Script" uid="uid://dj46jo3lfbclo" path="res://addons/card-framework/hand.gd" id="4_unpya"]
|
||||
[ext_resource type="Curve" uid="uid://bpxa7v4vk7pod" path="res://resources/Hand_Curve.tres" id="5_kdjyk"]
|
||||
[ext_resource type="Curve" uid="uid://c2d322obqbcgc" path="res://resources/Hand_Curve_Vert.tres" id="6_ikr1a"]
|
||||
[ext_resource type="Script" uid="uid://6ams8uvg43gu" path="res://addons/card-framework/pile.gd" id="7_rwigh"]
|
||||
[ext_resource type="Texture2D" uid="uid://jxi7my6yp71x" path="res://icon.svg" id="8_waqni"]
|
||||
[ext_resource type="Texture2D" uid="uid://besq7oa4a37mb" path="res://icon_red_background.webp" id="9_ggwjq"]
|
||||
[ext_resource type="Curve" uid="uid://ddxsxuabgpk7w" path="res://resources/Hand_Curve_invert.tres" id="10_kdjyk"]
|
||||
[ext_resource type="Curve" uid="uid://y6okl4wukojm" path="res://resources/Hand_Curve_Vert_invert.tres" id="10_unpya"]
|
||||
|
||||
[sub_resource type="CanvasTexture" id="CanvasTexture_ggwjq"]
|
||||
diffuse_texture = ExtResource("8_waqni")
|
||||
|
||||
[sub_resource type="CanvasTexture" id="CanvasTexture_unpya"]
|
||||
diffuse_texture = ExtResource("9_ggwjq")
|
||||
|
||||
[sub_resource type="CanvasTexture" id="CanvasTexture_kdjyk"]
|
||||
diffuse_texture = ExtResource("8_waqni")
|
||||
|
||||
[node name="Schematic" type="Node2D" unique_id=590430084]
|
||||
script = ExtResource("1_1j52r")
|
||||
metadata/_edit_vertical_guides_ = [960.0, 480.0, 1440.0, 790.0, 980.0]
|
||||
metadata/_edit_horizontal_guides_ = [600.0, 620.0, 370.0, 1000.0, -10.0]
|
||||
|
||||
[node name="CardManager" type="Control" parent="." unique_id=697562693]
|
||||
layout_mode = 3
|
||||
anchors_preset = 0
|
||||
offset_right = 40.0
|
||||
offset_bottom = 40.0
|
||||
script = ExtResource("2_waqni")
|
||||
card_factory_scene = ExtResource("3_ggwjq")
|
||||
metadata/_custom_type_script = "uid://clqgq1n7v0ar"
|
||||
|
||||
[node name="deck" type="Control" parent="CardManager" unique_id=1132160114]
|
||||
anchors_preset = 0
|
||||
offset_left = 960.0
|
||||
offset_top = 600.0
|
||||
offset_right = 960.0
|
||||
offset_bottom = 600.0
|
||||
script = ExtResource("7_rwigh")
|
||||
card_face_up = false
|
||||
enable_drop_zone = false
|
||||
metadata/_custom_type_script = "uid://6ams8uvg43gu"
|
||||
|
||||
[node name="Player1Hand" type="Control" parent="CardManager" unique_id=643995694]
|
||||
anchors_preset = 0
|
||||
offset_left = 480.0
|
||||
offset_top = 1000.0
|
||||
offset_right = 480.0
|
||||
offset_bottom = 1000.0
|
||||
script = ExtResource("4_unpya")
|
||||
max_hand_size = 9
|
||||
hand_rotation_curve = ExtResource("5_kdjyk")
|
||||
hand_vertical_curve = ExtResource("6_ikr1a")
|
||||
metadata/_custom_type_script = "uid://dj46jo3lfbclo"
|
||||
|
||||
[node name="Player1PlayPile" type="Control" parent="CardManager" unique_id=1899485437]
|
||||
anchors_preset = 0
|
||||
offset_left = 790.0
|
||||
offset_top = 620.0
|
||||
offset_right = 790.0
|
||||
offset_bottom = 620.0
|
||||
script = ExtResource("7_rwigh")
|
||||
sensor_texture = SubResource("CanvasTexture_ggwjq")
|
||||
sensor_visibility = true
|
||||
metadata/_custom_type_script = "uid://6ams8uvg43gu"
|
||||
|
||||
[node name="Player1Stiche" type="Control" parent="CardManager" unique_id=740577652]
|
||||
anchors_preset = 0
|
||||
offset_left = 790.0
|
||||
offset_top = 1000.0
|
||||
offset_right = 790.0
|
||||
offset_bottom = 1000.0
|
||||
script = ExtResource("7_rwigh")
|
||||
card_face_up = false
|
||||
sensor_texture = SubResource("CanvasTexture_unpya")
|
||||
metadata/_custom_type_script = "uid://6ams8uvg43gu"
|
||||
|
||||
[node name="Player2Hand" type="Control" parent="CardManager" unique_id=1455320999]
|
||||
anchors_preset = 0
|
||||
offset_left = 1440.0
|
||||
offset_top = 1000.0
|
||||
offset_right = 1440.0
|
||||
offset_bottom = 1000.0
|
||||
script = ExtResource("4_unpya")
|
||||
card_face_up = false
|
||||
hand_rotation_curve = ExtResource("5_kdjyk")
|
||||
hand_vertical_curve = ExtResource("6_ikr1a")
|
||||
metadata/_custom_type_script = "uid://dj46jo3lfbclo"
|
||||
|
||||
[node name="Player2PlayPile" type="Control" parent="CardManager" unique_id=1774061344]
|
||||
anchors_preset = 0
|
||||
offset_left = 980.0
|
||||
offset_top = 620.0
|
||||
offset_right = 980.0
|
||||
offset_bottom = 620.0
|
||||
script = ExtResource("7_rwigh")
|
||||
sensor_texture = SubResource("CanvasTexture_kdjyk")
|
||||
sensor_visibility = true
|
||||
metadata/_custom_type_script = "uid://6ams8uvg43gu"
|
||||
|
||||
[node name="Player2Stiche" type="Control" parent="CardManager" unique_id=561191290]
|
||||
anchors_preset = 0
|
||||
offset_left = 980.0
|
||||
offset_top = 1000.0
|
||||
offset_right = 980.0
|
||||
offset_bottom = 1000.0
|
||||
script = ExtResource("7_rwigh")
|
||||
card_face_up = false
|
||||
metadata/_custom_type_script = "uid://6ams8uvg43gu"
|
||||
|
||||
[node name="Player3Hand" type="Control" parent="CardManager" unique_id=1841661362]
|
||||
anchors_preset = 0
|
||||
offset_left = 1440.0
|
||||
offset_top = -10.0
|
||||
offset_right = 1440.0
|
||||
offset_bottom = -10.0
|
||||
script = ExtResource("4_unpya")
|
||||
card_face_up = false
|
||||
hand_rotation_curve = ExtResource("10_kdjyk")
|
||||
hand_vertical_curve = ExtResource("10_unpya")
|
||||
metadata/_custom_type_script = "uid://dj46jo3lfbclo"
|
||||
|
||||
[node name="Player3PlayPile" type="Control" parent="CardManager" unique_id=28196538]
|
||||
anchors_preset = 0
|
||||
offset_left = 980.0
|
||||
offset_top = 370.0
|
||||
offset_right = 980.0
|
||||
offset_bottom = 370.0
|
||||
script = ExtResource("7_rwigh")
|
||||
sensor_texture = ExtResource("8_waqni")
|
||||
sensor_visibility = true
|
||||
metadata/_custom_type_script = "uid://6ams8uvg43gu"
|
||||
|
||||
[node name="Player3Stiche" type="Control" parent="CardManager" unique_id=1273928195]
|
||||
anchors_preset = 0
|
||||
offset_left = 980.0
|
||||
offset_top = -10.0
|
||||
offset_right = 980.0
|
||||
offset_bottom = -10.0
|
||||
script = ExtResource("7_rwigh")
|
||||
card_face_up = false
|
||||
metadata/_custom_type_script = "uid://6ams8uvg43gu"
|
||||
|
||||
[node name="Player4Hand" type="Control" parent="CardManager" unique_id=1883169134]
|
||||
anchors_preset = 0
|
||||
offset_left = 480.0
|
||||
offset_top = -10.0
|
||||
offset_right = 480.0
|
||||
offset_bottom = -10.0
|
||||
script = ExtResource("4_unpya")
|
||||
card_face_up = false
|
||||
card_hover_distance = 0.0
|
||||
hand_rotation_curve = ExtResource("10_kdjyk")
|
||||
hand_vertical_curve = ExtResource("10_unpya")
|
||||
metadata/_custom_type_script = "uid://dj46jo3lfbclo"
|
||||
|
||||
[node name="Player4PlayPile" type="Control" parent="CardManager" unique_id=1625790580]
|
||||
anchors_preset = 0
|
||||
offset_left = 790.0
|
||||
offset_top = 370.0
|
||||
offset_right = 790.0
|
||||
offset_bottom = 370.0
|
||||
script = ExtResource("7_rwigh")
|
||||
sensor_texture = ExtResource("8_waqni")
|
||||
sensor_visibility = true
|
||||
metadata/_custom_type_script = "uid://6ams8uvg43gu"
|
||||
|
||||
[node name="Player4Stiche" type="Control" parent="CardManager" unique_id=1604931271]
|
||||
anchors_preset = 0
|
||||
offset_left = 790.0
|
||||
offset_top = -10.0
|
||||
offset_right = 790.0
|
||||
offset_bottom = -10.0
|
||||
script = ExtResource("7_rwigh")
|
||||
card_face_up = false
|
||||
metadata/_custom_type_script = "uid://6ams8uvg43gu"
|
||||
48
scenes/schematic_setup.gd
Normal file
48
scenes/schematic_setup.gd
Normal file
@@ -0,0 +1,48 @@
|
||||
extends Node2D
|
||||
|
||||
@onready var card_manager = $CardManager
|
||||
@onready var deck = $CardManager/deck
|
||||
@onready var player_1_hand = $CardManager/Player1Hand
|
||||
@onready var player_2_hand = $CardManager/Player2Hand
|
||||
@onready var player_3_hand = $CardManager/Player3Hand
|
||||
@onready var player_4_hand = $CardManager/Player4Hand
|
||||
|
||||
signal dealt
|
||||
|
||||
func _ready():
|
||||
setup_game()
|
||||
|
||||
func setup_game():
|
||||
# Create a deck of cards
|
||||
create_standard_deck()
|
||||
deck._held_cards.shuffle()
|
||||
|
||||
# Deal initial hand
|
||||
var deal_r: int =1
|
||||
while true:
|
||||
deal_cards_to_hand(3, player_1_hand)
|
||||
deal_cards_to_hand(3, player_2_hand)
|
||||
deal_cards_to_hand(3, player_3_hand)
|
||||
deal_cards_to_hand(3, player_4_hand)
|
||||
if deal_r == 3:
|
||||
dealt.emit()
|
||||
break
|
||||
else:
|
||||
await Timer.new()
|
||||
deal_r += 1
|
||||
|
||||
func create_standard_deck():
|
||||
var suits = ["Club", "Diamond", "Heart", "Spade"]
|
||||
var values = ["A", "6", "7", "8", "9", "10", "B", "Q", "K"]
|
||||
|
||||
for suit in suits:
|
||||
for value in values:
|
||||
var card_name = "%s_%s" % [suit, value]
|
||||
var card = card_manager.card_factory.create_card(card_name, deck)
|
||||
deck.add_card(card)
|
||||
|
||||
func deal_cards_to_hand(count: int, player):
|
||||
for i in count:
|
||||
if deck.get_card_count() > 0:
|
||||
var card = deck.get_top_cards(1).front()
|
||||
player.move_cards([card])
|
||||
1
scenes/schematic_setup.gd.uid
Normal file
1
scenes/schematic_setup.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://87mx553o86gf
|
||||
33
scenes/tabletop_menu.tscn
Normal file
33
scenes/tabletop_menu.tscn
Normal file
@@ -0,0 +1,33 @@
|
||||
[gd_scene format=3 uid="uid://b5rbmffyfi0nq"]
|
||||
|
||||
[node name="Tabletop_menu" type="Control"]
|
||||
layout_mode = 3
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
|
||||
[node name="Button_Start" type="Button" parent="."]
|
||||
layout_mode = 0
|
||||
offset_left = 481.0
|
||||
offset_top = 182.0
|
||||
offset_right = 631.0
|
||||
offset_bottom = 215.0
|
||||
text = "Start Learning"
|
||||
|
||||
[node name="Button_Continue" type="Button" parent="."]
|
||||
layout_mode = 0
|
||||
offset_left = 481.0
|
||||
offset_top = 221.0
|
||||
offset_right = 631.0
|
||||
offset_bottom = 254.0
|
||||
text = "Continue"
|
||||
|
||||
[node name="Button_Free Play" type="Button" parent="."]
|
||||
layout_mode = 0
|
||||
offset_left = 481.0
|
||||
offset_top = 261.0
|
||||
offset_right = 631.0
|
||||
offset_bottom = 294.0
|
||||
text = "Free Play"
|
||||
Reference in New Issue
Block a user