1
0
Fork 0

New card design

This commit is contained in:
Michaël Lemaire 2020-02-21 00:01:10 +01:00
parent a2549378eb
commit 2860e9181c
8 changed files with 108 additions and 62 deletions

View File

@ -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):

Binary file not shown.

Before

Width:  |  Height:  |  Size: 895 B

After

Width:  |  Height:  |  Size: 3.3 KiB

View File

@ -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">
<defs
id="defs2" />
id="defs2">
<filter
inkscape:collect="always"
style="color-interpolation-filters:sRGB"
id="filter1009"
x="-0.038727139"
width="1.0774543"
y="-0.41204792"
height="1.8240958">
<feGaussianBlur
inkscape:collect="always"
stdDeviation="3.4424544"
id="feGaussianBlur1011" />
</filter>
</defs>
<sodipodi:namedview
id="base"
pagecolor="#000000"
@ -28,9 +42,9 @@
borderopacity="1.0"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:zoom="3.436111"
inkscape:cx="93.468967"
inkscape:cy="125.13726"
inkscape:zoom="2"
inkscape:cx="89.482446"
inkscape:cy="170.66083"
inkscape:document-units="px"
inkscape:current-layer="g4549"
showgrid="true"
@ -41,16 +55,18 @@
inkscape:window-y="22"
inkscape:window-maximized="0"
inkscape:snap-page="true"
inkscape:snap-nodes="false"
inkscape:snap-nodes="true"
inkscape:object-nodes="true"
inkscape:object-paths="false"
inkscape:snap-global="true"
inkscape:showpageshadow="false"
inkscape:snap-bbox="true"
inkscape:snap-bbox="false"
inkscape:bbox-nodes="false"
inkscape:snap-to-guides="true"
scale-x="1"
inkscape:snap-bbox-midpoints="true">
inkscape:snap-bbox-midpoints="true"
inkscape:bbox-paths="true"
inkscape:snap-others="true">
<inkscape:grid
type="xygrid"
id="grid4596"
@ -69,7 +85,7 @@
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
@ -77,32 +93,56 @@
inkscape:label="Calque 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(0,-882.51965)">
transform="translate(0,-802.51965)">
<g
id="g4549"
transform="matrix(1,0,0,-1,0,2005.039)">
<path
style="fill:#3a6479;fill-opacity:1;stroke:#dbeff9;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="m 40,1201.5194 219,0 V 892.50002 l -9,-8.98067 H 10 l -9,9 v 270.00005 z"
id="path908"
inkscape:connector-curvature="0"
id="rect836"
d="m 2,1120.5194 176,1e-4 V 884.51935 l -176,1.8e-4 z"
style="opacity:1;fill:#1f2f4f;fill-opacity:1;stroke:#a5b7da;stroke-width:2;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
sodipodi:nodetypes="ccccc" />
sodipodi:nodetypes="cccccccc" />
<rect
y="901.51935"
x="9"
height="162"
width="162"
y="903.51935"
x="2"
height="256"
width="256"
id="rect4545"
style="opacity:1;fill:#6f83ac;fill-opacity:1;stroke:none;stroke-width:2.06981111;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
style="opacity:1;fill:#0e0e0e;fill-opacity:1;stroke:none;stroke-width:2.06981111;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
inkscape:export-xdpi="96"
inkscape:export-ydpi="96" />
<rect
y="1077.5194"
x="30"
height="34.999939"
width="120"
id="rect4545-3"
style="opacity:1;fill:#6f83ac;fill-opacity:1;stroke:none;stroke-width:0.80766743;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
<path
transform="scale(1,-1)"
style="opacity:1;fill:#1b3b4b;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
d="m 45,-1197.5194 200,0 5,35 -240,0 z"
id="rect910"
inkscape:connector-curvature="0"
sodipodi:nodetypes="ccccc" />
<path
style="fill:none;stroke:#dbeff9;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:none"
d="m 255,1162.5194 v 35"
id="path913"
inkscape:connector-curvature="0" />
<path
style="fill:none;stroke:#6690a4;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:none"
d="m 252,1162.5194 -2,35"
id="path915"
inkscape:connector-curvature="0" />
<path
sodipodi:type="inkscape:offset"
inkscape:radius="-7.9750552"
inkscape:original="M 45 -1197.5195 L 10 -1162.5195 L 250 -1162.5195 L 245 -1197.5195 L 45 -1197.5195 z "
style="opacity:0.63700005;fill:#000000;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;filter:url(#filter1009)"
id="path917"
d="m 48.302734,-1189.5449 -19.050781,19.0508 H 240.80469 l -2.72071,-19.0508 z"
transform="scale(1,-1)" />
<path
style="opacity:0.63700005;fill:#1b3b4b;fill-opacity:1;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
d="m 5,903.51935 h 250 l -11,-11 H 16 Z"
id="rect1013"
inkscape:connector-curvature="0"
sodipodi:nodetypes="ccccc" />
</g>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 3.5 KiB

After

Width:  |  Height:  |  Size: 5.5 KiB

View File

@ -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,

View File

@ -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 )

View File

@ -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

View File

@ -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

View File

@ -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\")