Add New Card Resouce Type

This commit is contained in:
CactiChameleon9 2022-07-16 12:06:46 +01:00
parent 97322b565f
commit dca0def350
14 changed files with 208 additions and 25 deletions

56
Assets/CardDB/CardBD.gd Normal file
View File

@ -0,0 +1,56 @@
extends Resource
class_name CardResource
enum TYPE {
DAMAGE
UTILITY
SPECIAL
EFFECT
MOVEMENT
}
enum EFFECT {
NONE
POISON
BURN
CONFUSION
WEAKNESS
SPLIT
DOUBLE
HALF
FLIP
DUPLICATE
REROLL
}
enum ACCEPTED_DICE {
DICE_1
DICE_2
DICE_3
DICE_4
DICE_5
DICE_6
}
export (TYPE) var type
export (int) var move_amount_addition
export (int) var move_dice_multiplyer
export (int) var damage_amount_addition
export (int) var damage_dice_multiplyer
export (Array, EFFECT) var effects
export (Array, ACCEPTED_DICE) var accepted_dice
export (int) var number_of_dice = 1
export (bool) var same_dice_requirement = false
export (bool) var addition_dice = false
export (int) var addition_amount = -1
export (String, MULTILINE) var description = ""

18
Assets/CardDB/Damage.tres Normal file
View File

@ -0,0 +1,18 @@
[gd_resource type="Resource" load_steps=2 format=2]
[ext_resource path="res://Assets/CardDB/CardBD.gd" type="Script" id=1]
[resource]
script = ExtResource( 1 )
type = 0
move_amount_addition = 0
move_dice_multiplyer = 0
damage_amount_addition = 0
damage_dice_multiplyer = 1
effects = [ ]
accepted_dice = [ ]
number_of_dice = 1
same_dice_requirement = false
addition_dice = false
addition_amount = -1
description = "Damage Dice Roll"

18
Assets/CardDB/Effect.tres Normal file
View File

@ -0,0 +1,18 @@
[gd_resource type="Resource" load_steps=2 format=2]
[ext_resource path="res://Assets/CardDB/CardBD.gd" type="Script" id=1]
[resource]
script = ExtResource( 1 )
type = 3
move_amount_addition = 0
move_dice_multiplyer = 1
damage_amount_addition = 0
damage_dice_multiplyer = 0
effects = [ 4 ]
accepted_dice = [ ]
number_of_dice = 1
same_dice_requirement = false
addition_dice = false
addition_amount = -1
description = "Move Dice Roll + 1"

18
Assets/CardDB/Move.tres Normal file
View File

@ -0,0 +1,18 @@
[gd_resource type="Resource" load_steps=2 format=2]
[ext_resource path="res://Assets/CardDB/CardBD.gd" type="Script" id=1]
[resource]
script = ExtResource( 1 )
type = 4
move_amount_addition = 1
move_dice_multiplyer = 1
damage_amount_addition = 0
damage_dice_multiplyer = 0
effects = [ ]
accepted_dice = [ ]
number_of_dice = 1
same_dice_requirement = false
addition_dice = false
addition_amount = -1
description = "Move Dice Roll + 1"

BIN
Assets/DiceInput.kra Normal file

Binary file not shown.

BIN
Assets/DiceInput.kra~ Normal file

Binary file not shown.

BIN
Assets/DiceInput.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 76 KiB

View File

@ -0,0 +1,35 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/DiceInput.png-4a82432d200f568448a278687e79c45c.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Assets/DiceInput.png"
dest_files=[ "res://.import/DiceInput.png-4a82432d200f568448a278687e79c45c.stex" ]
[params]
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=true
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0

BIN
Assets/DiceInput.png~ Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 77 KiB

View File

@ -1,25 +1,20 @@
tool
extends Control
export (Resource) var card_info
enum TYPE {
DAMAGE = 0
UTILITY = 1
SPECIAL = 2
EFFECT = 3
}
const TYPE_COLORS = [
Color("#db4758"), # DAMAGE
Color("#3cc361"), # UTILITY
Color("#ddd55c"), # SPECIAL
Color("#bc5ec6"), # EFFECT
Color("#a4a4a4"), # MOVEMENT
]
export (TYPE) var type
func _ready():
# change the color of the panel to match the appropriate type
var card_style = $PanelContainer.get('custom_styles/panel').duplicate(true)
card_style.set_bg_color(TYPE_COLORS[type])
card_style.set_bg_color(TYPE_COLORS[card_info.type])
$PanelContainer.set('custom_styles/panel', card_style)

View File

@ -1,7 +1,14 @@
[gd_scene load_steps=3 format=2]
[gd_scene load_steps=4 format=2]
[ext_resource path="res://UI/Card.gd" type="Script" id=1]
[ext_resource path="res://UI/CardStyle.tres" type="StyleBox" id=2]
[ext_resource path="res://Assets/CardDB/Move.tres" type="Resource" id=2]
[sub_resource type="StyleBoxFlat" id=1]
bg_color = Color( 0.858824, 0.278431, 0.345098, 1 )
corner_radius_top_left = 20
corner_radius_top_right = 20
corner_radius_bottom_right = 20
corner_radius_bottom_left = 20
[node name="Card" type="Control"]
anchor_right = 1.0
@ -9,8 +16,9 @@ anchor_bottom = 1.0
size_flags_horizontal = 3
size_flags_vertical = 3
script = ExtResource( 1 )
card_info = ExtResource( 2 )
[node name="PanelContainer" type="PanelContainer" parent="."]
anchor_right = 1.0
anchor_bottom = 1.0
custom_styles/panel = ExtResource( 2 )
custom_styles/panel = SubResource( 1 )

View File

@ -1,6 +1,7 @@
[gd_resource type="StyleBoxFlat" format=2]
[resource]
bg_color = Color( 0.643137, 0.643137, 0.643137, 1 )
corner_radius_top_left = 20
corner_radius_top_right = 20
corner_radius_bottom_right = 20

View File

@ -1,10 +1,16 @@
[gd_scene load_steps=2 format=2]
[gd_scene load_steps=6 format=2]
[ext_resource path="res://UI/Card.tscn" type="PackedScene" id=1]
[ext_resource path="res://Assets/CardDB/Damage.tres" type="Resource" id=2]
[ext_resource path="res://Assets/DiceInput.png" type="Texture" id=3]
[ext_resource path="res://Assets/Dice/Dice2.png" type="Texture" id=4]
[ext_resource path="res://Assets/CardDB/Effect.tres" type="Resource" id=5]
[node name="CardView" type="Control"]
anchor_right = 1.0
anchor_bottom = 1.0
margin_top = 277.0
margin_right = -252.0
[node name="HBox" type="HBoxContainer" parent="."]
anchor_right = 1.0
@ -14,22 +20,40 @@ custom_constants/separation = 50
[node name="Card1" parent="HBox" instance=ExtResource( 1 )]
anchor_right = 0.0
anchor_bottom = 0.0
margin_right = 308.0
margin_bottom = 600.0
type = 1
margin_right = 224.0
margin_bottom = 323.0
[node name="Card2" parent="HBox" instance=ExtResource( 1 )]
anchor_right = 0.0
anchor_bottom = 0.0
margin_left = 358.0
margin_right = 666.0
margin_bottom = 600.0
type = 2
margin_left = 274.0
margin_right = 498.0
margin_bottom = 323.0
card_info = ExtResource( 2 )
[node name="Card3" parent="HBox" instance=ExtResource( 1 )]
anchor_right = 0.0
anchor_bottom = 0.0
margin_left = 716.0
margin_right = 1024.0
margin_bottom = 600.0
type = 3
margin_left = 548.0
margin_right = 772.0
margin_bottom = 323.0
card_info = ExtResource( 5 )
[node name="DiceInput" type="Sprite" parent="."]
position = Vector2( 111, 109 )
scale = Vector2( 0.2, 0.2 )
texture = ExtResource( 3 )
[node name="DiceInput2" type="Sprite" parent="."]
position = Vector2( 662, 109 )
scale = Vector2( 0.2, 0.2 )
texture = ExtResource( 3 )
[node name="DiceInput3" type="Sprite" parent="."]
position = Vector2( 387, 108 )
scale = Vector2( 0.2, 0.2 )
texture = ExtResource( 3 )
[node name="Dice2" type="Sprite" parent="DiceInput3"]
position = Vector2( -1390, 15 )
texture = ExtResource( 4 )

View File

@ -8,6 +8,16 @@
config_version=4
_global_script_classes=[ {
"base": "Resource",
"class": "CardResource",
"language": "GDScript",
"path": "res://Assets/CardDB/CardBD.gd"
} ]
_global_script_class_icons={
"CardResource": ""
}
[application]
config/name="Quit Rolling Around"