diff --git a/cards/base_card.gd b/cards/base_card.gd
index 52c1377..250fdda 100644
--- a/cards/base_card.gd
+++ b/cards/base_card.gd
@@ -21,6 +21,9 @@ func _ready():
set_spawned_unit(spawned_unit)
base_position = position
+func get_size() -> Vector2:
+ return $background.texture.get_size()
+
func set_title(val):
title = val
if has_node("title"):
@@ -61,7 +64,7 @@ func set_hand_location(loc: Vector2):
base_position = loc
func update_anchors():
- var position = global_position if dragged else null
+ var position = global_position + (get_size() / 2) if dragged else null
selected_anchor = BattleHelper.update_anchors(get_tree(), position, funcref(self, "can_be_used_on_anchor"))
func play(anchor):
diff --git a/cards/base_card.png b/cards/base_card.png
index 1e93c4b..18cd8d4 100644
Binary files a/cards/base_card.png and b/cards/base_card.png differ
diff --git a/cards/base_card.svg b/cards/base_card.svg
index 8507d9a..991272e 100644
--- a/cards/base_card.svg
+++ b/cards/base_card.svg
@@ -9,9 +9,9 @@
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
- width="180"
- height="240"
- viewBox="0 0 180 240"
+ width="260"
+ height="320"
+ viewBox="0 0 260 320"
version="1.1"
id="svg8"
inkscape:version="0.92.4 (f8dce91, 2019-08-02)"
@@ -20,7 +20,21 @@
inkscape:export-xdpi="96"
inkscape:export-ydpi="96">
+ id="defs2">
+
+
+
+
+ inkscape:snap-bbox-midpoints="true"
+ inkscape:bbox-paths="true"
+ inkscape:snap-others="true">
image/svg+xml
-
+
@@ -77,32 +93,56 @@
inkscape:label="Calque 1"
inkscape:groupmode="layer"
id="layer1"
- transform="translate(0,-882.51965)">
+ transform="translate(0,-802.51965)">
+ sodipodi:nodetypes="cccccccc" />
-
+
+
+
+
+
diff --git a/cards/base_card.tscn b/cards/base_card.tscn
index 85ac010..39a784d 100644
--- a/cards/base_card.tscn
+++ b/cards/base_card.tscn
@@ -8,7 +8,8 @@
[ext_resource path="res://units/points.tscn" type="PackedScene" id=6]
[sub_resource type="DynamicFont" id=1]
-size = 22
+size = 32
+use_filter = true
font_data = ExtResource( 4 )
[node name="card" type="Node2D"]
@@ -18,17 +19,16 @@ z_as_relative = false
script = ExtResource( 2 )
[node name="background" type="Sprite" parent="."]
-position = Vector2( 90, 120 )
+position = Vector2( 130, 160 )
texture = ExtResource( 1 )
[node name="title" type="Label" parent="."]
margin_left = 30.0
-margin_top = 10.0
-margin_right = 150.0
-margin_bottom = 45.0
+margin_top = 4.0
+margin_right = 250.0
+margin_bottom = 44.0
theme = ExtResource( 3 )
custom_fonts/font = SubResource( 1 )
-custom_colors/font_color = Color( 0, 0, 0, 1 )
text = "Card"
align = 1
valign = 1
@@ -37,17 +37,16 @@ __meta__ = {
}
[node name="portrait" type="Sprite" parent="."]
-position = Vector2( 90, 140 )
-scale = Vector2( 0.6, 0.6 )
+position = Vector2( 130, 171 )
[node name="points" parent="." instance=ExtResource( 6 )]
visible = false
-position = Vector2( 90, 220 )
-scale = Vector2( 0.5, 0.5 )
+position = Vector2( 130, 299 )
+scale = Vector2( 0.75, 0.75 )
[node name="drag" type="Control" parent="."]
-margin_right = 180.0
-margin_bottom = 240.0
+margin_right = 260.0
+margin_bottom = 320.0
script = ExtResource( 5 )
__meta__ = {
"_edit_lock_": true,
diff --git a/decks/all.tscn b/decks/all.tscn
index fceff76..a6692f1 100644
--- a/decks/all.tscn
+++ b/decks/all.tscn
@@ -15,25 +15,25 @@
[node name="spawn_avenger" parent="." instance=ExtResource( 7 )]
[node name="spawn_breeze" parent="." instance=ExtResource( 3 )]
-position = Vector2( 200, 0 )
+position = Vector2( 270, 0 )
[node name="spawn_commorode" parent="." instance=ExtResource( 8 )]
-position = Vector2( 400, 0 )
+position = Vector2( 540, 0 )
[node name="spawn_creeper" parent="." instance=ExtResource( 9 )]
-position = Vector2( 600, 0 )
+position = Vector2( 810, 0 )
[node name="spawn_falcon" parent="." instance=ExtResource( 6 )]
-position = Vector2( 800, 0 )
+position = Vector2( 0, 330 )
[node name="spawn_flea" parent="." instance=ExtResource( 5 )]
-position = Vector2( 0, 300 )
+position = Vector2( 270, 330 )
[node name="spawn_jumper" parent="." instance=ExtResource( 4 )]
-position = Vector2( 200, 300 )
+position = Vector2( 540, 330 )
[node name="spawn_trapper" parent="." instance=ExtResource( 1 )]
-position = Vector2( 400, 300 )
+position = Vector2( 810, 330 )
[node name="spawn_xander" parent="." instance=ExtResource( 2 )]
-position = Vector2( 600, 300 )
+position = Vector2( 0, 660 )
diff --git a/screens/battle/battle.tscn b/screens/battle/battle.tscn
index b8c985c..47906e6 100644
--- a/screens/battle/battle.tscn
+++ b/screens/battle/battle.tscn
@@ -43,10 +43,10 @@ volume_db = -15.891
autoplay = true
[node name="hand_attack" type="Control" parent="."]
-margin_left = 240.0
-margin_top = 1660.0
-margin_right = 1050.0
-margin_bottom = 1900.0
+anchor_top = 1.0
+anchor_right = 1.0
+anchor_bottom = 1.0
+margin_top = -328.0
script = ExtResource( 6 )
__meta__ = {
"_edit_use_anchors_": false,
@@ -57,10 +57,10 @@ attack = true
[node name="skip" type="Button" parent="hand_attack"]
anchor_top = 1.0
anchor_bottom = 1.0
-margin_left = -240.0
-margin_top = -69.0
-margin_right = 82.0
-margin_bottom = 20.0
+margin_left = 10.0
+margin_top = -440.0
+margin_right = 332.0
+margin_bottom = -351.0
text = "Skip"
__meta__ = {
"_edit_use_anchors_": false
diff --git a/screens/battle/hand.gd b/screens/battle/hand.gd
index 9e7b65f..b2d50bf 100644
--- a/screens/battle/hand.gd
+++ b/screens/battle/hand.gd
@@ -23,10 +23,14 @@ func get_card_count():
func rearrange():
""" Rearrange visually the cards in hand
"""
- var i = 0
- for card in cards:
- card.set_hand_location(Vector2(i * 210, 0))
- i += 1
+ var cardcount = len(cards)
+ if cardcount:
+ var i = 0
+ var cardwidth = cards[0].get_size().x
+ var spacing = (rect_size.x - cardwidth * cardcount) / (cardcount + 1)
+ for card in cards:
+ card.set_hand_location(Vector2((i + 1) * (cardwidth + spacing) - cardwidth, 0))
+ i += 1
func on_card_played(card, anchor, unit):
""" Called when a card is played
diff --git a/screens/title/title.tscn b/screens/title/title.tscn
index cad1318..41cd51d 100644
--- a/screens/title/title.tscn
+++ b/screens/title/title.tscn
@@ -14,7 +14,7 @@ func _input(event):
if event is InputEventMouseButton:
if event.button_index == BUTTON_LEFT and not event.pressed:
$anims.seek(10)
-
+
func _on_skirmish_pressed():
if interactive:
get_tree().change_scene(\"res://screens/battle/battle.tscn\")