From 2860e9181cc889187c423b55b372ae17f5937010 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Lemaire?= Date: Fri, 21 Feb 2020 00:01:10 +0100 Subject: [PATCH] New card design --- cards/base_card.gd | 5 +- cards/base_card.png | Bin 895 -> 3375 bytes cards/base_card.svg | 96 ++++++++++++++++++++++++++----------- cards/base_card.tscn | 23 +++++---- decks/all.tscn | 16 +++---- screens/battle/battle.tscn | 16 +++---- screens/battle/hand.gd | 12 +++-- screens/title/title.tscn | 2 +- 8 files changed, 108 insertions(+), 62 deletions(-) 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 1e93c4b9af389dea8af383c2cce83c866ddc98da..18cd8d439621bb5724282b58fc7c815fe81409ef 100644 GIT binary patch literal 3375 zcmeHK{WlZ(A0IK}&QPieV{S=Z$5TRiSTs}$qau08mV_;vjUk&t8O83s2$v+TOV?8> zSxn}+gdTR0F*6GxW}Y>+yMFrq4c~L_=bYF1yxy<#dH?cyf6nWCK53rruBs~gQ~&^g z>giKRF91MJL533`piJ>=mB-6A1)|gG^B~zu09~cYYGwSXOGE$w((wawIln-(Wug|z z*_Y%Ud5uI4jtT*g$z+qT8xcfIFh0a2GAguS!EPS_0IoWXbUYthIM40N)ESDq#TTC6 zrLaHh&vQm2CknBJ`W9buYW2@V{d8$6G)rIk+1aG4WmP**?!6Kl8bC`>x}+R~eNzB% z*`FnkP1BTLBMrSRnN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 --- 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\")