WIP decks

This commit is contained in:
Hamcha 2019-05-07 00:18:10 +02:00
parent d553492e00
commit 69e0f4ce75
Signed by: hamcha
GPG key ID: A40413D21021EAEE
4 changed files with 15 additions and 5 deletions

View file

@ -1,9 +1,10 @@
[gd_scene load_steps=7 format=2]
[gd_scene load_steps=8 format=2]
[ext_resource path="res://Scenes/Scripts/Board.gd" type="Script" id=1]
[ext_resource path="res://Scenes/Scripts/Camera.gd" type="Script" id=2]
[ext_resource path="res://MLPAssets/Background/boardbg.jpg" type="Texture" id=3]
[ext_resource path="res://Scenes/BoardUI.tscn" type="PackedScene" id=4]
[ext_resource path="res://Scenes/Components/Stack.tscn" type="PackedScene" id=5]
[sub_resource type="SpatialMaterial" id=1]
flags_unshaded = true
@ -17,7 +18,7 @@ size = Vector2( 16, 9 )
script = ExtResource( 1 )
[node name="Camera" type="Camera" parent="."]
transform = Transform( 1, 0, 0, 0, 0.367808, 0.929902, 0, -0.929902, 0.367808, -0.232958, 4.94606, 3.11883 )
transform = Transform( 1, 0, 0, 0, 0.367808, 0.929902, 0, -0.929902, 0.367808, 0, 5.05934, 3.29185 )
script = ExtResource( 2 )
[node name="Hand" type="Spatial" parent="Camera"]
@ -31,3 +32,5 @@ material/0 = null
[node name="BoardUI" parent="." instance=ExtResource( 4 )]
[node name="Cards" type="Spatial" parent="."]
[node name="Deck" parent="Cards" instance=ExtResource( 5 )]

View file

@ -0,0 +1,3 @@
[gd_scene format=2]
[node name="Stack" type="Spatial"]

View file

@ -123,6 +123,10 @@ func reorder_hand():
cardsInHand.sort_custom(TransformSorter, "sort")
var size := cardsInHand.size()
# Check if we have nothing to order
if size < 1:
return
# Calculate total width of the player's hand and other things
# This is done in two ways, for small hands, MAX_CARD_DISTANCE is usually used
# as constant distance between cards, however, as the hand gets larger we don't