Skip to content

Commit

Permalink
Added token.
Browse files Browse the repository at this point in the history
  • Loading branch information
BraindeadBZH committed Jan 14, 2021
1 parent 42333b4 commit 1dbff15
Show file tree
Hide file tree
Showing 15 changed files with 370 additions and 15 deletions.
94 changes: 94 additions & 0 deletions _private/animations/token_anim.data
@@ -0,0 +1,94 @@
[meta]

id="token_anim"
name="Token Animation"

[idle]

pos=[ ]
scale=[ ]
rot=[ ]

[focused]

pos=[ ]
scale=[ {
"editable_transi": false,
"editable_val": false,
"val": {
"mode": "initial",
"num_range": 0.0,
"num_val": 0.0,
"vec_range": Vector2( 0, 0 ),
"vec_val": Vector2( 0, 0 )
}
}, {
"editable_transi": true,
"editable_val": true,
"transi": {
"duration": 0.2,
"duration_range_max": 0.3,
"duration_range_min": 0.1,
"easing": "out",
"flip_card": false,
"interactive": true,
"random_duration": false,
"type": "quad"
},
"val": {
"mode": "fixed",
"num_range": 0.0,
"num_val": 0.0,
"vec_range": Vector2( 0, 0 ),
"vec_val": Vector2( 1.2, 1.2 )
}
} ]
rot=[ ]

[activated]

pos=[ ]
scale=[ ]
rot=[ ]

[deactivated]

pos=[ ]
scale=[ ]
rot=[ ]

[unfocused]

pos=[ ]
scale=[ {
"editable_transi": false,
"editable_val": false,
"val": {
"mode": "initial",
"num_range": 0.0,
"num_val": 0.0,
"vec_range": Vector2( 0, 0 ),
"vec_val": Vector2( 0, 0 )
}
}, {
"editable_transi": true,
"editable_val": false,
"transi": {
"duration": 0.1,
"duration_range_max": 0.3,
"duration_range_min": 0.1,
"easing": "in",
"flip_card": false,
"interactive": true,
"random_duration": false,
"type": "quad"
},
"val": {
"mode": "initial",
"num_range": 0.0,
"num_val": 0.0,
"vec_range": Vector2( 0, 0 ),
"vec_val": Vector2( 0, 0 )
}
} ]
rot=[ ]
83 changes: 83 additions & 0 deletions _private/containers/token_grid/token_grid.data
@@ -0,0 +1,83 @@
[meta]

id="token_grid"
name="TokenGrid"
mode="grid"
face_up=true

[grid]

card_width=170.0
fixed_width=true
card_spacing=Vector2( 1.1, 1.1 )
halign="left"
valign="top"
columns=2
expand=false

[drag]

enabled=false

[path]

card_width=200.0
fixed_width=true
spacing=1.0

[position]

enabled=false
mode="linear"
min=Vector2( 0, 0 )
max=Vector2( 0, 0 )

[angle]

enabled=false
mode="linear"
min=0.0
max=0.0

[scale]

enabled=false
mode="linear"
ratio="keep"
min=Vector2( 0, 0 )
max=Vector2( 0, 0 )

[order]

duration=0.3
type="linear"
easing="in"

[in]

duration=0.3
type="linear"
easing="in"

[out]

duration=0.3
type="linear"
easing="in"

[anim]

interactive=true
id="token_anim"

[adjust]

mode="focused"
pos_mode_x="disabled"
pos_mode_y="disabled"
pos=Vector2( 0, 0 )
scale_mode_x="disabled"
scale_mode_y="disabled"
scale=Vector2( 0, 0 )
rot_mode="disabled"
rot=0.0
74 changes: 74 additions & 0 deletions _private/containers/token_grid/token_grid_private.gd
@@ -0,0 +1,74 @@
class_name TokenGridPrivate
extends AbstractContainer
# Private class for TokenGrid
# Generated automatically - DO NOT MODIFY

func _ready():
data_id = "token_grid"
data_name = "TokenGrid"

_layout_mode = LayoutMode.GRID
_face_up = true

# Grid parameters
_grid_card_width = 170
_grid_fixed_width = true
_grid_card_spacing = Vector2(1.1, 1.1)
_grid_halign = HALIGN_LEFT
_grid_valign = VALIGN_TOP
_grid_columns = 2
_grid_expand = false

# Drag and drop parameters
_drag_enabled = false

# Path parameters
_path_card_width = 200
_path_fixed_width = true
_path_spacing = 1

# Position fine tuning
_fine_pos = false
_fine_pos_mode = FineTuningMode.LINEAR
_fine_pos_min = Vector2(0, 0)
_fine_pos_max = Vector2(0, 0)

# Angle fine tuning
_fine_angle = false
_fine_angle_mode = FineTuningMode.LINEAR
_fine_angle_min = deg2rad(0)
_fine_angle_max = deg2rad(0)

# Scale fine tuning
_fine_scale = false
_fine_scale_mode = FineTuningMode.LINEAR
_fine_scale_ratio = AspectMode.KEEP
_fine_scale_min = Vector2(0, 0)
_fine_scale_max = Vector2(0, 0)

# Transitions
_transitions.order.duration = 0.3
_transitions.order.type = Tween.TRANS_LINEAR
_transitions.order.easing = Tween.EASE_IN

_transitions.in_anchor.duration = 0.3
_transitions.in_anchor.type = Tween.TRANS_LINEAR
_transitions.in_anchor.easing = Tween.EASE_IN

_transitions.out_anchor.duration = 0.3
_transitions.out_anchor.type = Tween.TRANS_LINEAR
_transitions.out_anchor.easing = Tween.EASE_IN

_interactive = true
_anim = "token_anim"

_adjust_mode = "focused"
_adjust_pos_x_mode = "disabled"
_adjust_pos_y_mode = "disabled"
_adjust_pos = Vector2(0, 0)
_adjust_scale_x_mode = "disabled"
_adjust_scale_y_mode = "disabled"
_adjust_scale = Vector2(0, 0)
_adjust_rot_mode = "disabled"
_adjust_rot = 0

8 changes: 8 additions & 0 deletions _private/containers/token_grid/token_grid_private.tscn
@@ -0,0 +1,8 @@
[gd_scene load_steps=3 format=2]

[ext_resource path="res://addons/cardengine/container/abstract_container.tscn" type="PackedScene" id=1]
[ext_resource path="res://_private/containers//token_grid/token_grid_private.gd" type="Script" id=2]

[node name="TokenGridPrivate" instance=ExtResource( 1 )]
script = ExtResource( 2 )

Binary file added cards/token/name_background.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 12 additions & 0 deletions cards/token/token.gd
@@ -0,0 +1,12 @@
extends AbstractCard

onready var _name = $AnimContainer/Front/NameBackground/Name


func _update_data(data: CardData) -> void:
if data.has_text("name"):
_name.text = data.get_text("name")


func _on_PlacedCard_instance_changed() -> void:
_update_data(instance().data())
57 changes: 57 additions & 0 deletions cards/token/token.tscn
@@ -0,0 +1,57 @@
[gd_scene load_steps=8 format=2]

[ext_resource path="res://fonts/ArchivoNarrow-Bold.ttf" type="DynamicFontData" id=1]
[ext_resource path="res://addons/cardengine/card/abstract_card.tscn" type="PackedScene" id=2]
[ext_resource path="res://cards/token/token.gd" type="Script" id=3]
[ext_resource path="res://cards/token/token_back.png" type="Texture" id=4]
[ext_resource path="res://cards/token/name_background.png" type="Texture" id=5]
[ext_resource path="res://cards/token/token_front.png" type="Texture" id=6]

[sub_resource type="DynamicFont" id=1]
size = 28
outline_size = 3
outline_color = Color( 0, 0, 0, 1 )
use_filter = true
font_data = ExtResource( 1 )

[node name="PlacedCard" instance=ExtResource( 2 )]
script = ExtResource( 3 )
size = Vector2( 300, 300 )

[node name="Background" type="Sprite" parent="AnimContainer/Placeholder" index="0"]
texture = ExtResource( 4 )

[node name="Background" type="Sprite" parent="AnimContainer/Front" index="0"]
texture = ExtResource( 6 )

[node name="NameBackground" type="Sprite" parent="AnimContainer/Front" index="1"]
position = Vector2( 0, 97.5 )
texture = ExtResource( 5 )

[node name="Name" type="Label" parent="AnimContainer/Front/NameBackground" index="0"]
anchor_right = 1.0
anchor_bottom = 1.0
margin_left = -151.0
margin_top = -24.0
margin_right = -195.0
margin_bottom = -67.0
custom_fonts/font = SubResource( 1 )
text = "Card Name"
align = 1
valign = 1
clip_text = true
__meta__ = {
"_edit_use_anchors_": false,
"_editor_description_": ""
}

[node name="MouseArea" parent="AnimContainer" index="3"]
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
margin_left = -150.0
margin_top = -150.0
margin_right = 150.0
margin_bottom = 150.0
[connection signal="instance_changed" from="." to="." method="_on_PlacedCard_instance_changed"]
Binary file added cards/token/token_back.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added cards/token/token_front.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions containers/token_grid/token_grid.gd
@@ -0,0 +1,4 @@
class_name TokenGrid
extends TokenGridPrivate
# Public class for TokenGrid

11 changes: 11 additions & 0 deletions containers/token_grid/token_grid.tscn
@@ -0,0 +1,11 @@
[gd_scene load_steps=4 format=2]

[ext_resource path="res://_private/containers/token_grid/token_grid_private.tscn" type="PackedScene" id=1]
[ext_resource path="res://containers/token_grid/token_grid.gd" type="Script" id=2]
[ext_resource path="res://cards/token/token.tscn" type="PackedScene" id=3]



[node name="TokenGrid" instance=ExtResource( 1 )]
script = ExtResource( 2 )
card_visual = ExtResource( 3 )
12 changes: 12 additions & 0 deletions project.godot
Expand Up @@ -254,6 +254,16 @@ _global_script_classes=[ {
"language": "GDScript",
"path": "res://addons/cardengine/animation/step_value.gd"
}, {
"base": "TokenGridPrivate",
"class": "TokenGrid",
"language": "GDScript",
"path": "res://containers/token_grid/token_grid.gd"
}, {
"base": "AbstractContainer",
"class": "TokenGridPrivate",
"language": "GDScript",
"path": "res://_private/containers/token_grid/token_grid_private.gd"
}, {
"base": "Node",
"class": "UtilsInstance",
"language": "GDScript",
Expand Down Expand Up @@ -324,6 +334,8 @@ _global_script_class_icons={
"ScaleSequence": "",
"StepTransition": "",
"StepValue": "",
"TokenGrid": "",
"TokenGridPrivate": "",
"UtilsInstance": "",
"ValueChange": "",
"ValueMultiplier": "",
Expand Down
1 change: 1 addition & 0 deletions screens/game/game_screen.gd
Expand Up @@ -23,6 +23,7 @@ onready var _draw_filter = $EffectsLayout/FilterLayout/DrawFilter
onready var _hand_filter = $EffectsLayout/FilterLayout/HandFilter
onready var _discard_filter = $EffectsLayout/FilterLayout/DiscardFilter
onready var _on_played_fx = $EffectsLayout/OnPlayedEffect
onready var _token_grid = $PlayZone/TokenGrid


func _ready() -> void:
Expand Down

0 comments on commit 1dbff15

Please sign in to comment.