Compare commits
82 Commits
97322b565f
...
main
Author | SHA1 | Date | |
---|---|---|---|
a6bc483e63 | |||
c96ac0e2d2 | |||
bf15a8a824 | |||
41c2689e1f | |||
a2185e081c | |||
ea2dde50e3 | |||
59bec36c08 | |||
a7256d56ed | |||
47f59a7a6d | |||
2176c95417 | |||
a0ad1442ad | |||
d863e991bb | |||
53462325c8 | |||
7040c0e09d | |||
4f89e06066 | |||
5002893113 | |||
40ccd28fb9 | |||
349a1bf0d3 | |||
40fb724000 | |||
87a5c280d6 | |||
eb29b2ce44 | |||
288cd288e4 | |||
3f2281a155 | |||
5d0b1933b6 | |||
321defe228 | |||
f019cdd1e3 | |||
f4b9d4718b | |||
c181c4f70b | |||
13ac881809 | |||
8bd768ebdc | |||
5216632ee2 | |||
e84ea6786c | |||
7da22c2461 | |||
a9b07decbf | |||
eab9ca42f6 | |||
67143708bc | |||
238a04b460 | |||
453330670b | |||
6fda66c7e0 | |||
e89eb7f15c | |||
69e00d25a3 | |||
c7ee498435 | |||
2b92579dc3 | |||
78bfa30e0e | |||
57ca632630 | |||
8abb393949 | |||
c6d26f9b77 | |||
b4e2f071df | |||
1e5fb13615 | |||
f2fad3bb0e | |||
3ad8e574dd | |||
d0e99788fb | |||
6ec76a2988 | |||
3df809aa9d | |||
6b2007ee1a | |||
a0ddbdae43 | |||
b4f33f30b6 | |||
08a265a14b | |||
634c9e9d30 | |||
5bd9d2efb3 | |||
929fc6291e | |||
e2db1fef29 | |||
c4b483b2a1 | |||
e78931e55e | |||
7b5d7f5ee7 | |||
862fb41a32 | |||
e9adc58583 | |||
219921d51b | |||
5d638e3f5b | |||
2dc7dfc3f6 | |||
12525b0095 | |||
e52716c793 | |||
70c4ba38e2 | |||
051cc25a38 | |||
6a6e74efa8 | |||
638bb9439a | |||
ce07155494 | |||
f7de541341 | |||
47025af8c5 | |||
8bf99ecae1 | |||
acf8506a22 | |||
dca0def350 |
3
.gitignore
vendored
@ -11,3 +11,6 @@ export_presets.cfg
|
||||
.mono/
|
||||
data_*/
|
||||
|
||||
# Krita
|
||||
*.png~
|
||||
*.kra~
|
||||
|
21
Assets/CardDB/Broadsword.tres
Normal file
@ -0,0 +1,21 @@
|
||||
[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 )
|
||||
name = "Broadsword"
|
||||
type = 0
|
||||
effect_damage_range = 2
|
||||
move_amount_addition = 0
|
||||
move_dice_multiplyer = 0
|
||||
damage_amount_addition = 0
|
||||
damage_dice_multiplyer = 1
|
||||
effects = [ ]
|
||||
accepted_dice = [ ]
|
||||
number_of_dice = 2
|
||||
same_dice_requirement = false
|
||||
addition_dice = false
|
||||
addition_amount = -1
|
||||
description = "Does damage equal to the sum of both dice to all enemies
|
||||
Range: 2 spaces"
|
44
Assets/CardDB/CardBD.gd
Normal file
@ -0,0 +1,44 @@
|
||||
extends Resource
|
||||
class_name CardResource
|
||||
|
||||
enum TYPE {
|
||||
DAMAGE
|
||||
UTILITY
|
||||
SPECIAL
|
||||
EFFECT
|
||||
MOVEMENT
|
||||
}
|
||||
|
||||
enum ACCEPTED_DICE {
|
||||
DICE_1 = 1
|
||||
DICE_2 = 2
|
||||
DICE_3 = 3
|
||||
DICE_4 = 4
|
||||
DICE_5 = 5
|
||||
DICE_6 = 6
|
||||
}
|
||||
|
||||
export (String) var name = ""
|
||||
|
||||
export (TYPE) var type
|
||||
|
||||
export (int) var effect_damage_range = 0
|
||||
|
||||
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, Global.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 = ""
|
||||
|
20
Assets/CardDB/Default.tres
Normal file
@ -0,0 +1,20 @@
|
||||
[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 )
|
||||
name = "Default"
|
||||
type = 0
|
||||
effect_damage_range = 0
|
||||
move_amount_addition = 0
|
||||
move_dice_multiplyer = 0
|
||||
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 = "Default Description"
|
20
Assets/CardDB/Magic Carving Knife.tres
Normal file
@ -0,0 +1,20 @@
|
||||
[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 )
|
||||
name = "Magic Carving Knife"
|
||||
type = 1
|
||||
effect_damage_range = 0
|
||||
move_amount_addition = 0
|
||||
move_dice_multiplyer = 0
|
||||
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 = "Split your dice in half"
|
21
Assets/CardDB/Poisonous apple.tres
Normal file
@ -0,0 +1,21 @@
|
||||
[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 )
|
||||
name = "Poisonous apple"
|
||||
type = 3
|
||||
effect_damage_range = 3
|
||||
move_amount_addition = 0
|
||||
move_dice_multiplyer = 0
|
||||
damage_amount_addition = 0
|
||||
damage_dice_multiplyer = 0
|
||||
effects = [ 0, 9 ]
|
||||
accepted_dice = [ 1, 2, 3 ]
|
||||
number_of_dice = 1
|
||||
same_dice_requirement = false
|
||||
addition_dice = false
|
||||
addition_amount = -1
|
||||
description = "Poison enemies and reroll your dice
|
||||
Range: 3 spaces"
|
20
Assets/CardDB/Sprint.tres
Normal file
@ -0,0 +1,20 @@
|
||||
[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 )
|
||||
name = "Sprint"
|
||||
type = 4
|
||||
effect_damage_range = 0
|
||||
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 your dice roll + 1 spaces"
|
Before Width: | Height: | Size: 62 KiB After Width: | Height: | Size: 64 KiB |
@ -2,28 +2,30 @@
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/Dice1.png-c31ee42d20faf89dc4419ed68829ce60.stex"
|
||||
path.s3tc="res://.import/Dice1.png-c31ee42d20faf89dc4419ed68829ce60.s3tc.stex"
|
||||
path.etc2="res://.import/Dice1.png-c31ee42d20faf89dc4419ed68829ce60.etc2.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
"imported_formats": [ "s3tc", "etc2" ],
|
||||
"vram_texture": true
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://Assets/Dice/Dice1.png"
|
||||
dest_files=[ "res://.import/Dice1.png-c31ee42d20faf89dc4419ed68829ce60.stex" ]
|
||||
dest_files=[ "res://.import/Dice1.png-c31ee42d20faf89dc4419ed68829ce60.s3tc.stex", "res://.import/Dice1.png-c31ee42d20faf89dc4419ed68829ce60.etc2.stex" ]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/mode=2
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_mode=0
|
||||
compress/bptc_ldr=0
|
||||
compress/normal_map=0
|
||||
flags/repeat=0
|
||||
flags/repeat=true
|
||||
flags/filter=true
|
||||
flags/mipmaps=false
|
||||
flags/mipmaps=true
|
||||
flags/anisotropic=false
|
||||
flags/srgb=2
|
||||
flags/srgb=1
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/HDR_as_SRGB=false
|
||||
@ -31,5 +33,5 @@ process/invert_color=false
|
||||
process/normal_map_invert_y=false
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=true
|
||||
detect_3d=false
|
||||
svg/scale=1.0
|
||||
|
Before Width: | Height: | Size: 57 KiB After Width: | Height: | Size: 62 KiB |
Before Width: | Height: | Size: 68 KiB After Width: | Height: | Size: 72 KiB |
@ -2,28 +2,30 @@
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/Dice2.png-071424701e7950d00863aca8d7bce48a.stex"
|
||||
path.s3tc="res://.import/Dice2.png-071424701e7950d00863aca8d7bce48a.s3tc.stex"
|
||||
path.etc2="res://.import/Dice2.png-071424701e7950d00863aca8d7bce48a.etc2.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
"imported_formats": [ "s3tc", "etc2" ],
|
||||
"vram_texture": true
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://Assets/Dice/Dice2.png"
|
||||
dest_files=[ "res://.import/Dice2.png-071424701e7950d00863aca8d7bce48a.stex" ]
|
||||
dest_files=[ "res://.import/Dice2.png-071424701e7950d00863aca8d7bce48a.s3tc.stex", "res://.import/Dice2.png-071424701e7950d00863aca8d7bce48a.etc2.stex" ]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/mode=2
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_mode=0
|
||||
compress/bptc_ldr=0
|
||||
compress/normal_map=0
|
||||
flags/repeat=0
|
||||
flags/repeat=true
|
||||
flags/filter=true
|
||||
flags/mipmaps=false
|
||||
flags/mipmaps=true
|
||||
flags/anisotropic=false
|
||||
flags/srgb=2
|
||||
flags/srgb=1
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/HDR_as_SRGB=false
|
||||
@ -31,5 +33,5 @@ process/invert_color=false
|
||||
process/normal_map_invert_y=false
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=true
|
||||
detect_3d=false
|
||||
svg/scale=1.0
|
||||
|
Before Width: | Height: | Size: 62 KiB After Width: | Height: | Size: 68 KiB |
Before Width: | Height: | Size: 73 KiB After Width: | Height: | Size: 76 KiB |
Before Width: | Height: | Size: 65 KiB |
Before Width: | Height: | Size: 70 KiB After Width: | Height: | Size: 73 KiB |
Before Width: | Height: | Size: 69 KiB After Width: | Height: | Size: 72 KiB |
Before Width: | Height: | Size: 74 KiB After Width: | Height: | Size: 77 KiB |
BIN
Assets/DiceInput.kra
Normal file
BIN
Assets/DiceInput.kra~
Normal file
BIN
Assets/DiceInput.png
Normal file
After Width: | Height: | Size: 76 KiB |
35
Assets/DiceInput.png.import
Normal 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
After Width: | Height: | Size: 77 KiB |
BIN
Assets/DiceInputBold.kra
Normal file
BIN
Assets/DiceInputBold.png
Normal file
After Width: | Height: | Size: 72 KiB |
35
Assets/DiceInputBold.png.import
Normal file
@ -0,0 +1,35 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/DiceInputBold.png-dc499cd822102d68e5e44449ce5835a3.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://Assets/DiceInputBold.png"
|
||||
dest_files=[ "res://.import/DiceInputBold.png-dc499cd822102d68e5e44449ce5835a3.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/Metropolis-font/Metropolis-Black.ttf
Normal file
BIN
Assets/Metropolis-font/Metropolis-BlackItalic.ttf
Normal file
BIN
Assets/Metropolis-font/Metropolis-Bold.ttf
Normal file
BIN
Assets/Metropolis-font/Metropolis-BoldItalic.ttf
Normal file
BIN
Assets/Metropolis-font/Metropolis-ExtraBold.ttf
Normal file
BIN
Assets/Metropolis-font/Metropolis-ExtraBoldItalic.ttf
Normal file
BIN
Assets/Metropolis-font/Metropolis-ExtraLight.ttf
Normal file
BIN
Assets/Metropolis-font/Metropolis-ExtraLightItalic.ttf
Normal file
BIN
Assets/Metropolis-font/Metropolis-Light.ttf
Normal file
BIN
Assets/Metropolis-font/Metropolis-LightItalic.ttf
Normal file
BIN
Assets/Metropolis-font/Metropolis-Medium.ttf
Normal file
BIN
Assets/Metropolis-font/Metropolis-MediumItalic.ttf
Normal file
BIN
Assets/Metropolis-font/Metropolis-Regular.ttf
Normal file
BIN
Assets/Metropolis-font/Metropolis-RegularItalic.ttf
Normal file
BIN
Assets/Metropolis-font/Metropolis-SemiBold.ttf
Normal file
BIN
Assets/Metropolis-font/Metropolis-SemiBoldItalic.ttf
Normal file
BIN
Assets/Metropolis-font/Metropolis-Thin.ttf
Normal file
BIN
Assets/Metropolis-font/Metropolis-ThinItalic.ttf
Normal file
BIN
Assets/TestTile.png
Normal file
After Width: | Height: | Size: 1.3 KiB |
35
Assets/TestTile.png.import
Normal file
@ -0,0 +1,35 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/TestTile.png-f25e43c55ebf25b13707fee90777f4c7.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://Assets/TestTile.png"
|
||||
dest_files=[ "res://.import/TestTile.png-f25e43c55ebf25b13707fee90777f4c7.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
|
103
AutoGridContainer - Full Version/AutoGridContainer.gd
Normal file
@ -0,0 +1,103 @@
|
||||
extends Control
|
||||
|
||||
#"soft" because it isn't enforced if the grid wouldn't fit otherwise
|
||||
export var soft_minimum_columns : int = 2
|
||||
#these should come from the theme or from theme overrides
|
||||
export var grid_hseperation : int = 4
|
||||
export var grid_vseperation : int = 4
|
||||
|
||||
var _node_width = -1
|
||||
var _node_height = -1
|
||||
|
||||
onready var grid_container = $Scroll/VBox/GridContainer
|
||||
|
||||
func _update_node_size():
|
||||
if len(grid_container.get_children()) == 0:
|
||||
return -1
|
||||
|
||||
#duplicate a node, assuming they are all the same
|
||||
$MinSizeTesting.add_child(grid_container.get_child(0).duplicate())
|
||||
#set the size to the minimum
|
||||
$MinSizeTesting.get_child(0).rect_size = Vector2(0, 0)
|
||||
|
||||
#get the smallest possible size they can contain
|
||||
_node_width = $MinSizeTesting.get_child(0).rect_size.x
|
||||
_node_height = $MinSizeTesting.get_child(0).rect_size.y
|
||||
#plus any seperation due to the grid
|
||||
_node_width += grid_hseperation
|
||||
_node_height += grid_vseperation
|
||||
|
||||
#remove the copied node
|
||||
$MinSizeTesting.get_child(0).queue_free()
|
||||
|
||||
|
||||
func _process(_delta: float) -> void:
|
||||
_move_children_to_grid()
|
||||
|
||||
#don't do anything if there are no children
|
||||
if len(grid_container.get_children()) == 0:
|
||||
return
|
||||
#don't do anything if the node's haven't got a size yet
|
||||
if _node_width == -1 or _node_height == -1:
|
||||
_update_node_size()
|
||||
return
|
||||
|
||||
#window_size in case an issue occures with resizing
|
||||
var screen_width = min(rect_size.x, OS.window_size.x)
|
||||
var screen_height = min(rect_size.y, OS.window_size.y)
|
||||
|
||||
#(columns - 1) means that it can still shrink in size
|
||||
grid_container.columns = max(1, int(screen_width/_node_width) - 1)
|
||||
#don't allow more columns than children (wasted space)
|
||||
grid_container.columns = min(grid_container.columns, grid_container.get_child_count())
|
||||
|
||||
#this is used to adjust the columns so that maximum space avalible is used
|
||||
for _i in 10:
|
||||
var empty_rows = _calculate_empty_rows(grid_container.columns, screen_height)
|
||||
|
||||
#check if perfect height already
|
||||
if empty_rows <= 0:
|
||||
break
|
||||
|
||||
#disallow single width (unless required previously)
|
||||
if grid_container.columns <= soft_minimum_columns:
|
||||
break
|
||||
|
||||
#check that it won't need to scroll if columns change
|
||||
if _get_rows(grid_container.columns - 1) * _node_height > screen_height:
|
||||
break
|
||||
|
||||
grid_container.columns -= 1
|
||||
|
||||
|
||||
func _calculate_empty_rows(columns, screen_height):
|
||||
var rows = _get_rows(columns)
|
||||
|
||||
var height_not_used : int = screen_height - rows * _node_height
|
||||
var empty_rows : int = height_not_used / _node_height
|
||||
|
||||
return empty_rows
|
||||
|
||||
|
||||
func _get_rows(columns):
|
||||
# rows = children // columns + 1 (if remainder)
|
||||
var rows = grid_container.get_child_count() / columns
|
||||
rows += 1 if grid_container.get_child_count() % columns != 0 else 0
|
||||
|
||||
return rows
|
||||
|
||||
|
||||
func _move_children_to_grid():
|
||||
#puts the children into the grid container
|
||||
#ignores the first 2 children (container and size tester)
|
||||
for _i in range(2, get_child_count()):
|
||||
var child = get_child(2)
|
||||
remove_child(child)
|
||||
grid_container.add_child(child)
|
||||
|
||||
#allow getting nodes from the grid (null, no error version)
|
||||
func get_node_from_grid(node_path : NodePath) -> Node:
|
||||
if grid_container.has_node(node_path):
|
||||
return grid_container.get_node(node_path)
|
||||
else:
|
||||
return null
|
33
AutoGridContainer - Full Version/AutoGridContainer.tscn
Normal file
@ -0,0 +1,33 @@
|
||||
[gd_scene load_steps=2 format=2]
|
||||
|
||||
[ext_resource path="res://AutoGridContainer - Full Version/AutoGridContainer.gd" type="Script" id=1]
|
||||
|
||||
[node name="AutoGridContainer" type="Control"]
|
||||
margin_right = 1024.0
|
||||
margin_bottom = 600.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
script = ExtResource( 1 )
|
||||
|
||||
[node name="Scroll" type="ScrollContainer" parent="."]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
rect_clip_content = false
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
scroll_horizontal_enabled = false
|
||||
|
||||
[node name="VBox" type="VBoxContainer" parent="Scroll"]
|
||||
margin_right = 1024.0
|
||||
margin_bottom = 600.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
|
||||
[node name="GridContainer" type="GridContainer" parent="Scroll/VBox"]
|
||||
margin_right = 1024.0
|
||||
margin_bottom = 600.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
columns = 3
|
||||
|
||||
[node name="MinSizeTesting" type="Node" parent="."]
|
51
Characters/Character.gd
Normal file
@ -0,0 +1,51 @@
|
||||
extends Node2D
|
||||
class_name Character
|
||||
|
||||
export var base_max_health : int = 20
|
||||
export (int, 1, 5) var level : int = 1 setget level_change
|
||||
|
||||
var health = base_max_health
|
||||
|
||||
|
||||
var map_position : Vector2 = Vector2.ZERO
|
||||
onready var target_position : Vector2 = position
|
||||
var moving : bool = false
|
||||
|
||||
var cards = [] setget ,get_cards
|
||||
var dice = []
|
||||
|
||||
|
||||
func get_cards():
|
||||
for child in get_children():
|
||||
if "Card" in child.name:
|
||||
cards.append(child)
|
||||
|
||||
return cards
|
||||
|
||||
|
||||
func level_change(new_level):
|
||||
# when leveing up restore health
|
||||
health = base_max_health * pow(level, 1.5)
|
||||
level = new_level
|
||||
|
||||
|
||||
func _physics_process(delta):
|
||||
|
||||
# If the 2 positions are close enough, then not moving
|
||||
moving = false if target_position.round() == position.round() else true
|
||||
|
||||
if not moving: return
|
||||
|
||||
#TODO: Replace with tween magic
|
||||
position += (target_position - position)/2.5
|
||||
|
||||
|
||||
func take_damage(damage):
|
||||
health -= damage
|
||||
if health <= 0:
|
||||
die()
|
||||
|
||||
|
||||
func die():
|
||||
#Animation here
|
||||
queue_free()
|
1
Characters/Enemy.gd
Normal file
@ -0,0 +1 @@
|
||||
extends Character
|
11
Characters/Enemy.tscn
Normal file
@ -0,0 +1,11 @@
|
||||
[gd_scene load_steps=3 format=2]
|
||||
|
||||
[ext_resource path="res://icon.png" type="Texture" id=1]
|
||||
[ext_resource path="res://Characters/Enemy.gd" type="Script" id=2]
|
||||
|
||||
[node name="Enemy" type="Node2D" groups=["Enemy", "OnMap"]]
|
||||
script = ExtResource( 2 )
|
||||
|
||||
[node name="Sprite" type="Sprite" parent="."]
|
||||
modulate = Color( 1, 0, 0, 1 )
|
||||
texture = ExtResource( 1 )
|
@ -1,17 +1 @@
|
||||
extends Node2D
|
||||
|
||||
export var map_position : Vector2 = Vector2.ZERO
|
||||
|
||||
var target_position : Vector2 = Vector2.ZERO
|
||||
var moving : bool = false
|
||||
|
||||
|
||||
func _physics_process(delta):
|
||||
|
||||
# If the 2 positions are close enough, then not moving
|
||||
moving = false if target_position.round() == position.round() else true
|
||||
|
||||
if not moving: return
|
||||
|
||||
#TODO: Replace with tween magic
|
||||
position += (target_position - position)/2.5
|
||||
extends Character
|
||||
|
@ -3,7 +3,7 @@
|
||||
[ext_resource path="res://icon.png" type="Texture" id=1]
|
||||
[ext_resource path="res://Characters/Player.gd" type="Script" id=2]
|
||||
|
||||
[node name="Player" type="Node2D"]
|
||||
[node name="Player" type="Node2D" groups=["OnMap"]]
|
||||
script = ExtResource( 2 )
|
||||
|
||||
[node name="Sprite" type="Sprite" parent="."]
|
||||
|
15
Global.gd
Normal file
@ -0,0 +1,15 @@
|
||||
extends Node
|
||||
|
||||
enum EFFECT {
|
||||
POISON
|
||||
BURN
|
||||
CONFUSION
|
||||
WEAKNESS
|
||||
|
||||
SPLIT
|
||||
DOUBLE
|
||||
HALF
|
||||
FLIP
|
||||
DUPLICATE
|
||||
REROLL
|
||||
}
|
49
Management/ActiveController.gd
Normal file
@ -0,0 +1,49 @@
|
||||
extends Node
|
||||
|
||||
var current_active : int = 0
|
||||
|
||||
|
||||
func _process(_delta):
|
||||
the_connecting()
|
||||
the_pausing()
|
||||
|
||||
|
||||
func the_pausing():
|
||||
# iterate through the children, allowing only the current active node to run
|
||||
for i in len(get_children()):
|
||||
if get_child(i).has_signal("scene_finished"): # only change if active var should exist
|
||||
get_child(i).active = true if i == current_active else false
|
||||
|
||||
|
||||
func the_connecting():
|
||||
# iterate through the children and connect up the child_finished method
|
||||
for i in len(get_children()):
|
||||
|
||||
# connect the finished signal if it exists and
|
||||
# if the failed finished isn't already connected
|
||||
if (get_child(i).has_signal("scene_finished") and
|
||||
get_child(i).get_signal_connection_list("scene_finished") == []):
|
||||
|
||||
get_child(i).connect("scene_finished", self, "child_finished")
|
||||
|
||||
|
||||
# connect the failed signal if it exists and
|
||||
# if the failed signal isn't already connected
|
||||
if (get_child(i).has_signal("scene_failed") and
|
||||
get_child(i).get_signal_connection_list("scene_failed") == []):
|
||||
|
||||
get_child(i).connect("scene_failed", self, "child_failed")
|
||||
|
||||
|
||||
func child_finished():
|
||||
# designed to be called from a signal
|
||||
current_active += 1
|
||||
if current_active >= len(get_children()):
|
||||
current_active = 0
|
||||
|
||||
|
||||
func child_failed():
|
||||
# designed to be called from a signal
|
||||
current_active -= 1
|
||||
if current_active < 0:
|
||||
current_active = len(get_children()) - 1
|
6
Management/ActiveController.tscn
Normal file
@ -0,0 +1,6 @@
|
||||
[gd_scene load_steps=2 format=2]
|
||||
|
||||
[ext_resource path="res://Management/ActiveController.gd" type="Script" id=1]
|
||||
|
||||
[node name="ActiveController" type="Node"]
|
||||
script = ExtResource( 1 )
|
86
Scenes/Battle.gd
Normal file
@ -0,0 +1,86 @@
|
||||
extends Node2D
|
||||
|
||||
signal scene_finished
|
||||
signal scene_failed
|
||||
|
||||
var active : bool = false
|
||||
|
||||
var character = null setget new_character
|
||||
var movement_queue = []
|
||||
var character_original_position : Vector2 = Vector2.ZERO
|
||||
var character_movement_range = 5
|
||||
|
||||
|
||||
|
||||
func new_character(chara):
|
||||
|
||||
# don't allow non-character characters
|
||||
if not chara.is_in_group("OnMap"):
|
||||
return
|
||||
|
||||
# clear the movement queue upon a change in character
|
||||
movement_queue = []
|
||||
|
||||
# set the character's map postiton
|
||||
chara.map_position = $TileMap.world_to_map(chara.position)
|
||||
chara.target_position = $TileMap.map_to_world(chara.map_position)
|
||||
chara.target_position += $TileMap.cell_size/2
|
||||
|
||||
# set the original_position
|
||||
character_original_position = chara.map_position
|
||||
|
||||
character = chara
|
||||
|
||||
|
||||
func character_movement_input():
|
||||
if Input.is_action_just_pressed("ui_up"):
|
||||
movement_queue.append(Vector2.UP)
|
||||
if Input.is_action_just_pressed("ui_down"):
|
||||
movement_queue.append(Vector2.DOWN)
|
||||
if Input.is_action_just_pressed("ui_left"):
|
||||
movement_queue.append(Vector2.LEFT)
|
||||
if Input.is_action_just_pressed("ui_right"):
|
||||
movement_queue.append(Vector2.RIGHT)
|
||||
|
||||
if Input.is_action_just_pressed("ui_accept"):
|
||||
emit_signal("scene_finished")
|
||||
|
||||
|
||||
func character_movement():
|
||||
#remove uneeded inputs from the queue
|
||||
for i in len(movement_queue) - 1:
|
||||
#remove if adjacent values are opposites
|
||||
if (movement_queue[i].x * movement_queue[i+1].x == -1 or
|
||||
movement_queue[i].y * movement_queue[i+1].y == -1):
|
||||
movement_queue[i] = Vector2.ZERO
|
||||
movement_queue[i+1] = Vector2.ZERO
|
||||
#remove null values
|
||||
for i in len(movement_queue):
|
||||
if movement_queue.find(Vector2.ZERO) != -1:
|
||||
movement_queue.remove(movement_queue.find(Vector2.ZERO))
|
||||
|
||||
if len(movement_queue) == 0:
|
||||
return
|
||||
|
||||
if not character.moving:
|
||||
|
||||
var total_distance = character.map_position + movement_queue[0]
|
||||
total_distance -= character_original_position
|
||||
|
||||
#if the character is moving too far, cancel movement and empty queue
|
||||
if total_distance.length() > character_movement_range:
|
||||
movement_queue = []
|
||||
return
|
||||
|
||||
#move the character once space in the queue if not moving
|
||||
character.map_position += movement_queue.pop_front()
|
||||
character.target_position = $TileMap.map_to_world(character.map_position)
|
||||
character.target_position += $TileMap.cell_size/2
|
||||
|
||||
|
||||
func _physics_process(_delta):
|
||||
if not active:
|
||||
return
|
||||
|
||||
character_movement()
|
||||
character_movement_input()
|
48
Scenes/Battle.tscn
Normal file
@ -0,0 +1,48 @@
|
||||
[gd_scene load_steps=5 format=2]
|
||||
|
||||
[ext_resource path="res://icon.png" type="Texture" id=1]
|
||||
[ext_resource path="res://Assets/TestTile.png" type="Texture" id=2]
|
||||
[ext_resource path="res://Scenes/Battle.gd" type="Script" id=3]
|
||||
|
||||
[sub_resource type="TileSet" id=1]
|
||||
0/name = "icon.png 0"
|
||||
0/texture = ExtResource( 1 )
|
||||
0/tex_offset = Vector2( 0, 0 )
|
||||
0/modulate = Color( 1, 1, 1, 1 )
|
||||
0/region = Rect2( 8, 4, 51, 19 )
|
||||
0/tile_mode = 0
|
||||
0/occluder_offset = Vector2( 0, 0 )
|
||||
0/navigation_offset = Vector2( 0, 0 )
|
||||
0/shape_offset = Vector2( 0, 0 )
|
||||
0/shape_transform = Transform2D( 1, 0, 0, 1, 0, 0 )
|
||||
0/shape_one_way = false
|
||||
0/shape_one_way_margin = 0.0
|
||||
0/shapes = [ ]
|
||||
0/z_index = 0
|
||||
1/name = "TestTile.png 1"
|
||||
1/texture = ExtResource( 2 )
|
||||
1/tex_offset = Vector2( 16, 0 )
|
||||
1/modulate = Color( 1, 1, 1, 1 )
|
||||
1/region = Rect2( 0, 0, 160, 64 )
|
||||
1/tile_mode = 0
|
||||
1/occluder_offset = Vector2( 0, 0 )
|
||||
1/navigation_offset = Vector2( 0, 0 )
|
||||
1/shape_offset = Vector2( 0, 0 )
|
||||
1/shape_transform = Transform2D( 1, 0, 0, 1, 0, 0 )
|
||||
1/shape_one_way = false
|
||||
1/shape_one_way_margin = 0.0
|
||||
1/shapes = [ ]
|
||||
1/z_index = 0
|
||||
|
||||
[node name="Battle" type="Node2D"]
|
||||
unique_name_in_owner = true
|
||||
script = ExtResource( 3 )
|
||||
|
||||
[node name="TileMap" type="TileMap" parent="."]
|
||||
mode = 2
|
||||
tile_set = SubResource( 1 )
|
||||
cell_size = Vector2( 128, 64 )
|
||||
cell_custom_transform = Transform2D( 128, 0, 32, 64, 0, 0 )
|
||||
centered_textures = true
|
||||
format = 1
|
||||
tile_data = PoolIntArray( 65538, 1, 0, 65539, 1, 0, 65540, 1, 0, 65541, 1, 0, 131074, 1, 0, 131075, 1, 0, 131076, 1, 0, 131077, 1, 0, 131078, 0, 0, 196610, 1, 0, 196611, 1, 0, 196612, 1, 0, 196613, 1, 0, 196614, 0, 0, 262144, 0, 0, 262145, 0, 0, 262146, 1, 0, 262147, 1, 0, 262148, 1, 0, 262149, 0, 0, 262150, 0, 0, 327681, 0, 0, 327682, 0, 0, 327683, 0, 0, 327684, 0, 0, 327685, 0, 0, 327686, 0, 0, 393217, 0, 0, 393218, 0, 0, 393219, 0, 0, 393220, 0, 0, 393221, 0, 0, 393222, 0, 0, 458754, 0, 0, 458755, 0, 0, 458756, 0, 0, 458757, 0, 0, 524291, 0, 0, 524292, 0, 0 )
|
@ -1,35 +1,7 @@
|
||||
extends Node2D
|
||||
extends Node
|
||||
|
||||
var movement_queue = []
|
||||
|
||||
func _physics_process(delta):
|
||||
|
||||
if Input.is_action_just_pressed("ui_up"):
|
||||
movement_queue.append(Vector2.UP)
|
||||
if Input.is_action_just_pressed("ui_down"):
|
||||
movement_queue.append(Vector2.DOWN)
|
||||
if Input.is_action_just_pressed("ui_left"):
|
||||
movement_queue.append(Vector2.LEFT)
|
||||
if Input.is_action_just_pressed("ui_right"):
|
||||
movement_queue.append(Vector2.RIGHT)
|
||||
|
||||
#remove uneeded inputs from the queue
|
||||
for i in len(movement_queue) - 1:
|
||||
#remove if adjacent values are opposites
|
||||
if (movement_queue[i].x * movement_queue[i+1].x == -1 or
|
||||
movement_queue[i].y * movement_queue[i+1].y == -1):
|
||||
movement_queue[i] = Vector2.ZERO
|
||||
movement_queue[i+1] = Vector2.ZERO
|
||||
#remove null values
|
||||
for i in len(movement_queue):
|
||||
if movement_queue.find(Vector2.ZERO) != -1:
|
||||
movement_queue.remove(movement_queue.find(Vector2.ZERO))
|
||||
|
||||
if len(movement_queue) == 0:
|
||||
return
|
||||
|
||||
#move the character once space in the queue if not moving
|
||||
if not $Player.moving:
|
||||
$Player.map_position += movement_queue.pop_front()
|
||||
$Player.target_position = $TileMap.map_to_world($Player.map_position)
|
||||
$Player.target_position += $TileMap.cell_size/2
|
||||
func _ready():
|
||||
$"%Battle".character = $Player
|
||||
$"%CardContainer".character = $Player
|
||||
$"%DiceContainer".character = $Player
|
||||
|
@ -1,35 +1,41 @@
|
||||
[gd_scene load_steps=5 format=2]
|
||||
[gd_scene load_steps=10 format=2]
|
||||
|
||||
[ext_resource path="res://icon.png" type="Texture" id=1]
|
||||
[ext_resource path="res://Scenes/Battle.tscn" type="PackedScene" id=1]
|
||||
[ext_resource path="res://Characters/Player.tscn" type="PackedScene" id=2]
|
||||
[ext_resource path="res://Scenes/BattleScene.gd" type="Script" id=3]
|
||||
[ext_resource path="res://UI/CardContainer.tscn" type="PackedScene" id=4]
|
||||
[ext_resource path="res://UI/DiceContainer.tscn" type="PackedScene" id=5]
|
||||
[ext_resource path="res://UI/Card.gd" type="Script" id=6]
|
||||
[ext_resource path="res://Assets/CardDB/Broadsword.tres" type="Resource" id=7]
|
||||
[ext_resource path="res://Management/ActiveController.tscn" type="PackedScene" id=8]
|
||||
[ext_resource path="res://Assets/CardDB/Poisonous apple.tres" type="Resource" id=9]
|
||||
|
||||
[sub_resource type="TileSet" id=1]
|
||||
0/name = "icon.png 0"
|
||||
0/texture = ExtResource( 1 )
|
||||
0/tex_offset = Vector2( 0, 0 )
|
||||
0/modulate = Color( 1, 1, 1, 1 )
|
||||
0/region = Rect2( 8, 4, 51, 19 )
|
||||
0/tile_mode = 0
|
||||
0/occluder_offset = Vector2( 0, 0 )
|
||||
0/navigation_offset = Vector2( 0, 0 )
|
||||
0/shape_offset = Vector2( 0, 0 )
|
||||
0/shape_transform = Transform2D( 1, 0, 0, 1, 0, 0 )
|
||||
0/shape_one_way = false
|
||||
0/shape_one_way_margin = 0.0
|
||||
0/shapes = [ ]
|
||||
0/z_index = 0
|
||||
|
||||
[node name="BattleScene" type="Node2D"]
|
||||
[node name="BattleScene" type="Node"]
|
||||
script = ExtResource( 3 )
|
||||
|
||||
[node name="TileMap" type="TileMap" parent="."]
|
||||
mode = 2
|
||||
tile_set = SubResource( 1 )
|
||||
cell_size = Vector2( 128, 64 )
|
||||
cell_custom_transform = Transform2D( 128, 0, 32, 64, 0, 0 )
|
||||
centered_textures = true
|
||||
format = 1
|
||||
tile_data = PoolIntArray( 65540, 0, 0, 131074, 0, 0, 131075, 0, 0, 131076, 0, 0, 131077, 0, 0, 131078, 0, 0, 196610, 0, 0, 196611, 0, 0, 196612, 0, 0, 196613, 0, 0, 196614, 0, 0, 262144, 0, 0, 262145, 0, 0, 262146, 0, 0, 262147, 0, 0, 262148, 0, 0, 262149, 0, 0, 262150, 0, 0, 327681, 0, 0, 327682, 0, 0, 327683, 0, 0, 327684, 0, 0, 327685, 0, 0, 327686, 0, 0, 393217, 0, 0, 393218, 0, 0, 393219, 0, 0, 393220, 0, 0, 393221, 0, 0, 393222, 0, 0, 458754, 0, 0, 458755, 0, 0, 458756, 0, 0, 458757, 0, 0, 524291, 0, 0, 524292, 0, 0 )
|
||||
[node name="ActiveController" parent="." instance=ExtResource( 8 )]
|
||||
|
||||
[node name="Battle" parent="ActiveController" instance=ExtResource( 1 )]
|
||||
|
||||
[node name="CardContainer" parent="ActiveController" instance=ExtResource( 4 )]
|
||||
unique_name_in_owner = true
|
||||
margin_top = 351.0
|
||||
margin_right = -425.0
|
||||
|
||||
[node name="DiceContainer" parent="ActiveController" instance=ExtResource( 5 )]
|
||||
unique_name_in_owner = true
|
||||
margin_left = 782.0
|
||||
margin_top = 375.0
|
||||
|
||||
[node name="Player" parent="." instance=ExtResource( 2 )]
|
||||
|
||||
[node name="Card1" type="Node" parent="Player"]
|
||||
script = ExtResource( 6 )
|
||||
card_info = ExtResource( 7 )
|
||||
|
||||
[node name="Card2" type="Node" parent="Player"]
|
||||
script = ExtResource( 6 )
|
||||
|
||||
[node name="Card3" type="Node" parent="Player"]
|
||||
script = ExtResource( 6 )
|
||||
card_info = ExtResource( 9 )
|
||||
|
162
UI/Card.gd
@ -1,25 +1,143 @@
|
||||
tool
|
||||
extends Control
|
||||
extends Node
|
||||
class_name Card
|
||||
|
||||
signal return_dice(dice_number)
|
||||
signal do_movement(movement_range)
|
||||
signal do_damage(damage, damage_range)
|
||||
signal do_effect(effect, effect_range)
|
||||
signal card_removed()
|
||||
|
||||
export (Resource) var card_info = preload("res://Assets/CardDB/Default.tres")
|
||||
|
||||
var input_dice = []
|
||||
var addition_dice_amount = card_info.addition_amount
|
||||
|
||||
func dice_inputted(dice_number):
|
||||
|
||||
# -- SINGLE DICE CHECKS --
|
||||
if dice_number == null:
|
||||
return
|
||||
|
||||
#check if dice is within dice range
|
||||
if dice_number < 1 and dice_number > 6:
|
||||
return
|
||||
|
||||
#if accepted dice is specified, check if the dice is in the list
|
||||
if (len(card_info.accepted_dice) != 0 and
|
||||
not dice_number in card_info.accepted_dice):
|
||||
emit_signal("return_dice", dice_number)
|
||||
return
|
||||
|
||||
#add the dice to the input if it passes individual checks
|
||||
input_dice.append(dice_number)
|
||||
|
||||
# -- MULTI DICE CHECKS --
|
||||
#if same dice requirement, then check if true
|
||||
if card_info.same_dice_requirement:
|
||||
var same_dice = true
|
||||
|
||||
for i in range(1, len(input_dice)):
|
||||
if input_dice[i-1] != input_dice[i]:
|
||||
same_dice = false
|
||||
break
|
||||
|
||||
# if not all the same dice then return all of the dice
|
||||
if not same_dice:
|
||||
for _i in len(input_dice):
|
||||
emit_signal("return_dice", input_dice[0])
|
||||
input_dice.remove(0)
|
||||
|
||||
|
||||
# -- RUN DICE CHECKS --
|
||||
|
||||
# if the addition type, then lower the counter by the input dice
|
||||
# also check (and run) if the amount is reaches and
|
||||
if card_info.addition_dice:
|
||||
|
||||
addition_dice_amount -= dice_number
|
||||
|
||||
if addition_dice_amount <= 0:
|
||||
run_card()
|
||||
return
|
||||
|
||||
# run the card if the correct number of dice have been inputted (and normal dice)
|
||||
if (len(input_dice) == card_info.number_of_dice
|
||||
and not card_info.addition_dice):
|
||||
run_card()
|
||||
|
||||
|
||||
enum TYPE {
|
||||
DAMAGE = 0
|
||||
UTILITY = 1
|
||||
SPECIAL = 2
|
||||
EFFECT = 3
|
||||
}
|
||||
func run_card():
|
||||
# calculate the damage amount
|
||||
var damage = card_info.damage_amount_addition
|
||||
for dice_number in input_dice:
|
||||
damage += card_info.damage_dice_multiplyer * dice_number
|
||||
|
||||
if damage != 0:
|
||||
emit_signal("do_damage", damage, card_info.effect_damage_range)
|
||||
|
||||
# calculate the damage amount
|
||||
var movement = card_info.move_amount_addition
|
||||
for dice_number in input_dice:
|
||||
movement += card_info.move_dice_multiplyer * dice_number
|
||||
|
||||
if movement != 0:
|
||||
emit_signal("do_movement", movement)
|
||||
|
||||
# do any utility dice returns
|
||||
for dice_number in input_dice:
|
||||
|
||||
if Global.EFFECT.SPLIT in card_info.effects:
|
||||
var halfed_dice = float(dice_number)/2.0
|
||||
|
||||
var new_dice1 = halfed_dice
|
||||
var new_dice2 = halfed_dice
|
||||
|
||||
#if decimal value, then minus half and add half
|
||||
if decimals(halfed_dice) != 0:
|
||||
new_dice1 -= 0.5
|
||||
new_dice2 += 0.5
|
||||
|
||||
emit_signal("return_dice", new_dice1)
|
||||
emit_signal("return_dice", new_dice2)
|
||||
|
||||
if Global.EFFECT.DOUBLE in card_info.effects:
|
||||
var new_dice1 = dice_number * 2
|
||||
var new_dice2 = 0
|
||||
|
||||
#dice has to be smaller than 7
|
||||
if new_dice1 > 6:
|
||||
new_dice1 -= 6
|
||||
new_dice2 = 6
|
||||
|
||||
emit_signal("return_dice", new_dice1)
|
||||
if new_dice2 != 0: emit_signal("return_dice", new_dice1)
|
||||
|
||||
if Global.EFFECT.HALF in card_info.effects:
|
||||
var new_dice = float(dice_number)/2.0
|
||||
|
||||
#if decimal valued, add 0.5 or - 0.5 at random
|
||||
if decimals(new_dice) != 0:
|
||||
new_dice += round(randf()) - 0.5
|
||||
|
||||
emit_signal("return_dice", new_dice)
|
||||
|
||||
if Global.EFFECT.FLIP in card_info.effects:
|
||||
# all opposite sides of a dice add up to 7
|
||||
emit_signal("return_dice", 7 - dice_number)
|
||||
|
||||
if Global.EFFECT.DUPLICATE in card_info.effects:
|
||||
emit_signal("return_dice", dice_number)
|
||||
emit_signal("return_dice", dice_number)
|
||||
|
||||
# for each effect, emit do effect with the range
|
||||
for effect in card_info.effects:
|
||||
emit_signal("do_effect", effect, card_info.effect_damage_range)
|
||||
|
||||
|
||||
#clear the input dice
|
||||
input_dice = []
|
||||
|
||||
#card is used, disappear
|
||||
emit_signal("card_removed")
|
||||
queue_free()
|
||||
|
||||
const TYPE_COLORS = [
|
||||
Color("#db4758"), # DAMAGE
|
||||
Color("#3cc361"), # UTILITY
|
||||
Color("#ddd55c"), # SPECIAL
|
||||
Color("#bc5ec6"), # EFFECT
|
||||
]
|
||||
|
||||
export (TYPE) var type
|
||||
|
||||
|
||||
func _ready():
|
||||
var card_style = $PanelContainer.get('custom_styles/panel').duplicate(true)
|
||||
card_style.set_bg_color(TYPE_COLORS[type])
|
||||
$PanelContainer.set('custom_styles/panel', card_style)
|
||||
|
16
UI/Card.tscn
@ -1,16 +0,0 @@
|
||||
[gd_scene load_steps=3 format=2]
|
||||
|
||||
[ext_resource path="res://UI/Card.gd" type="Script" id=1]
|
||||
[ext_resource path="res://UI/CardStyle.tres" type="StyleBox" id=2]
|
||||
|
||||
[node name="Card" type="Control"]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
script = ExtResource( 1 )
|
||||
|
||||
[node name="PanelContainer" type="PanelContainer" parent="."]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
custom_styles/panel = ExtResource( 2 )
|
27
UI/CardContainer.tscn
Normal file
@ -0,0 +1,27 @@
|
||||
[gd_scene load_steps=3 format=2]
|
||||
|
||||
[ext_resource path="res://UI/CardView.tscn" type="PackedScene" id=1]
|
||||
[ext_resource path="res://UI/ItemContainer.gd" type="Script" id=2]
|
||||
|
||||
[node name="CardContainer" type="Control"]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
script = ExtResource( 2 )
|
||||
item_view_scene = ExtResource( 1 )
|
||||
child_holder = NodePath("Margin/HBox")
|
||||
character_property = "cards"
|
||||
view_property = "card"
|
||||
|
||||
[node name="Margin" type="MarginContainer" parent="."]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
margin_left = 30.0
|
||||
margin_top = 30.0
|
||||
margin_right = -30.0
|
||||
margin_bottom = -30.0
|
||||
|
||||
[node name="HBox" type="HBoxContainer" parent="Margin"]
|
||||
margin_right = 1220.0
|
||||
margin_bottom = 660.0
|
||||
rect_min_size = Vector2( 0, 300 )
|
||||
custom_constants/separation = 50
|
@ -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
|
||||
|
136
UI/CardView.gd
Normal file
@ -0,0 +1,136 @@
|
||||
extends Control
|
||||
|
||||
signal card_view_removed(card_view)
|
||||
|
||||
const TYPE_COLORS = [
|
||||
Color("#db4758"), # DAMAGE
|
||||
Color("#3cc361"), # UTILITY
|
||||
Color("#bcb64f"), # SPECIAL
|
||||
Color("#bc5ec6"), # EFFECT
|
||||
Color("#a4a4a4"), # MOVEMENT
|
||||
]
|
||||
|
||||
const input_dice_view = preload("res://UI/InputDiceView.tscn")
|
||||
var input_dice_views = []
|
||||
|
||||
var hovering : bool = false setget set_hovering
|
||||
|
||||
var card : Card = Card.new() setget update_cardview
|
||||
|
||||
|
||||
func update_cardview(new_card = null):
|
||||
|
||||
# allow the update card function to work with and without setget
|
||||
if new_card != null and new_card != card:
|
||||
disconnect_signals()
|
||||
card = new_card
|
||||
connect_signals()
|
||||
|
||||
# change the color of the panel to match the appropriate type
|
||||
var card_style = $"%Background".get('custom_styles/panel').duplicate(true)
|
||||
card_style.set_bg_color(TYPE_COLORS[card.card_info.type])
|
||||
$"%Background".set('custom_styles/panel', card_style)
|
||||
|
||||
# change the name and description
|
||||
$"%Name".text = card.card_info.name
|
||||
$"%Description".text = card.card_info.description
|
||||
|
||||
# remove the old input dice views
|
||||
for i in input_dice_views:
|
||||
i.queue_free()
|
||||
input_dice_views = []
|
||||
|
||||
# add the correct number of input dice views
|
||||
for i in card.card_info.number_of_dice:
|
||||
add_input_dice_view()
|
||||
|
||||
# set the extra info
|
||||
var extra_text = ""
|
||||
if card.card_info.addition_dice == true:
|
||||
# set the dice to have the remaining addition
|
||||
extra_text = str(card.addition_dice_amount)
|
||||
|
||||
else:
|
||||
# set the dice to have a list of accepted dice
|
||||
for dice in card.card_info.accepted_dice:
|
||||
extra_text += str(dice) + ", "
|
||||
extra_text = extra_text.trim_suffix(", ")
|
||||
|
||||
for i in input_dice_views:
|
||||
i.set_extra_info(extra_text)
|
||||
|
||||
# set bold dice if addition dice
|
||||
if card.card_info.addition_dice == true:
|
||||
for i in input_dice_views:
|
||||
i.bold = true
|
||||
|
||||
#TODO: same dice UI support
|
||||
#TODO: hover UI support maybe
|
||||
|
||||
|
||||
# add an input_dice_view to the array (for easy management)
|
||||
# and to the autogrid
|
||||
func add_input_dice_view():
|
||||
var dice_view = input_dice_view.instance()
|
||||
input_dice_views.append(dice_view)
|
||||
$"%AutoGrid".add_child(dice_view)
|
||||
|
||||
|
||||
# this is run once the card emits card_removed
|
||||
func card_view_run(do_emit_signal : bool = true):
|
||||
# emit card_view_removed signal
|
||||
if do_emit_signal: emit_signal("card_view_removed", self)
|
||||
|
||||
# play the disappearing input dice animation
|
||||
play_input_dice_animations()
|
||||
|
||||
# play the using animation
|
||||
$AnimationPlayer.play("Fly Off")
|
||||
yield($AnimationPlayer, "animation_finished")
|
||||
|
||||
# remove the card completely once used
|
||||
queue_free()
|
||||
|
||||
|
||||
func card_view_remove(do_emit_signal : bool = true):
|
||||
# emit card_view_removed signal
|
||||
if do_emit_signal: emit_signal("card_view_removed", self)
|
||||
|
||||
# play the remove animation
|
||||
$AnimationPlayer.play("Drop Off")
|
||||
yield($AnimationPlayer, "animation_finished")
|
||||
|
||||
# remove the card completely once used
|
||||
queue_free()
|
||||
|
||||
|
||||
func play_input_dice_animations():
|
||||
for i in input_dice_views:
|
||||
i.run_disappear_animation()
|
||||
|
||||
|
||||
func disconnect_signals():
|
||||
if card.get_signal_connection_list("card_removed") == []:
|
||||
return
|
||||
|
||||
card.disconnect("card_removed", self, "card_view_run")
|
||||
|
||||
|
||||
func connect_signals():
|
||||
card.connect("card_removed", self, "card_view_run")
|
||||
|
||||
|
||||
func set_hovering(value : bool):
|
||||
# set the hovering value
|
||||
hovering = value
|
||||
|
||||
# wait until the old animation is finished
|
||||
if ($AnimationPlayer.current_animation != "Hovering"
|
||||
and $AnimationPlayer.current_animation != ""):
|
||||
yield($AnimationPlayer, "animation_finished")
|
||||
|
||||
if hovering:
|
||||
$AnimationPlayer.play("Hovering")
|
||||
|
||||
if not hovering:
|
||||
$AnimationPlayer.play("RESET")
|
202
UI/CardView.tscn
@ -1,35 +1,189 @@
|
||||
[gd_scene load_steps=2 format=2]
|
||||
[gd_scene load_steps=12 format=2]
|
||||
|
||||
[ext_resource path="res://UI/Card.tscn" type="PackedScene" id=1]
|
||||
[ext_resource path="res://UI/CardView.gd" type="Script" id=1]
|
||||
[ext_resource path="res://Assets/Metropolis-font/Metropolis-Bold.ttf" type="DynamicFontData" id=4]
|
||||
[ext_resource path="res://AutoGridContainer - Full Version/AutoGridContainer.tscn" type="PackedScene" id=6]
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id=9]
|
||||
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
|
||||
|
||||
[sub_resource type="DynamicFontData" id=4]
|
||||
font_path = "res://Assets/Metropolis-font/Metropolis-Bold.ttf"
|
||||
|
||||
[sub_resource type="DynamicFont" id=2]
|
||||
size = 30
|
||||
use_filter = true
|
||||
font_data = SubResource( 4 )
|
||||
|
||||
[sub_resource type="DynamicFont" id=5]
|
||||
size = 20
|
||||
use_filter = true
|
||||
font_data = ExtResource( 4 )
|
||||
|
||||
[sub_resource type="Animation" id=10]
|
||||
resource_name = "Drop Off"
|
||||
length = 0.5
|
||||
tracks/0/type = "value"
|
||||
tracks/0/path = NodePath("LocalPosition:rect_position")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/keys = {
|
||||
"times": PoolRealArray( 0, 0.5 ),
|
||||
"transitions": PoolRealArray( 0.297304, 1 ),
|
||||
"update": 0,
|
||||
"values": [ Vector2( 0, 0 ), Vector2( 0, 800 ) ]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id=7]
|
||||
resource_name = "Fly Off"
|
||||
length = 1.5
|
||||
step = 0.01
|
||||
tracks/0/type = "value"
|
||||
tracks/0/path = NodePath("LocalPosition:rect_position")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/keys = {
|
||||
"times": PoolRealArray( 0, 0.4, 0.65, 1.3 ),
|
||||
"transitions": PoolRealArray( 0.647041, 0.647041, 4, 1 ),
|
||||
"update": 0,
|
||||
"values": [ Vector2( 0, 0 ), Vector2( 0, 0 ), Vector2( 0, 20 ), Vector2( 0, -700 ) ]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/path = NodePath(".:rect_scale")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/keys = {
|
||||
"times": PoolRealArray( 0, 0.65, 1.3 ),
|
||||
"transitions": PoolRealArray( 1, 6.06286, 1 ),
|
||||
"update": 0,
|
||||
"values": [ Vector2( 1, 1 ), Vector2( 1, 1 ), Vector2( 1, 1.4 ) ]
|
||||
}
|
||||
tracks/2/type = "method"
|
||||
tracks/2/path = NodePath(".")
|
||||
tracks/2/interp = 1
|
||||
tracks/2/loop_wrap = true
|
||||
tracks/2/imported = false
|
||||
tracks/2/enabled = true
|
||||
tracks/2/keys = {
|
||||
"times": PoolRealArray( 0 ),
|
||||
"transitions": PoolRealArray( 1 ),
|
||||
"values": [ {
|
||||
"args": [ ],
|
||||
"method": "play_input_dice_animations"
|
||||
} ]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id=11]
|
||||
resource_name = "Hovering"
|
||||
length = 0.15
|
||||
step = 0.01
|
||||
tracks/0/type = "value"
|
||||
tracks/0/path = NodePath("LocalPosition:rect_position")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/keys = {
|
||||
"times": PoolRealArray( 0, 0.15 ),
|
||||
"transitions": PoolRealArray( 6.9644, 1 ),
|
||||
"update": 0,
|
||||
"values": [ Vector2( 0, 0 ), Vector2( 0, -40 ) ]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id=8]
|
||||
length = 0.001
|
||||
tracks/0/type = "value"
|
||||
tracks/0/path = NodePath("LocalPosition:rect_position")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/keys = {
|
||||
"times": PoolRealArray( 0 ),
|
||||
"transitions": PoolRealArray( 1 ),
|
||||
"update": 0,
|
||||
"values": [ Vector2( 0, 0 ) ]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/path = NodePath(".:rect_scale")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/keys = {
|
||||
"times": PoolRealArray( 0 ),
|
||||
"transitions": PoolRealArray( 1 ),
|
||||
"update": 0,
|
||||
"values": [ Vector2( 1, 1 ) ]
|
||||
}
|
||||
|
||||
[node name="CardView" type="Control"]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
margin_right = -965.0
|
||||
margin_bottom = -325.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
script = ExtResource( 1 )
|
||||
|
||||
[node name="HBox" type="HBoxContainer" parent="."]
|
||||
[node name="LocalPosition" type="Control" parent="."]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
custom_constants/separation = 50
|
||||
margin_bottom = 6.10352e-05
|
||||
|
||||
[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
|
||||
[node name="Background" type="PanelContainer" parent="LocalPosition"]
|
||||
unique_name_in_owner = true
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
custom_styles/panel = SubResource( 9 )
|
||||
|
||||
[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
|
||||
[node name="VBox" type="VBoxContainer" parent="LocalPosition"]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
margin_left = 10.0
|
||||
margin_top = 10.0
|
||||
margin_right = -10.0
|
||||
margin_bottom = -10.0
|
||||
|
||||
[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
|
||||
[node name="Name" type="Label" parent="LocalPosition/VBox"]
|
||||
unique_name_in_owner = true
|
||||
margin_right = 295.0
|
||||
margin_bottom = 31.0
|
||||
custom_fonts/font = SubResource( 2 )
|
||||
text = "Default"
|
||||
align = 1
|
||||
autowrap = true
|
||||
|
||||
[node name="AutoGrid" parent="LocalPosition/VBox" instance=ExtResource( 6 )]
|
||||
unique_name_in_owner = true
|
||||
margin_top = 35.0
|
||||
margin_right = 295.0
|
||||
margin_bottom = 281.0
|
||||
|
||||
[node name="Description" type="Label" parent="LocalPosition/VBox"]
|
||||
unique_name_in_owner = true
|
||||
margin_top = 285.0
|
||||
margin_right = 295.0
|
||||
margin_bottom = 375.0
|
||||
rect_min_size = Vector2( 0, 90 )
|
||||
custom_fonts/font = SubResource( 5 )
|
||||
text = "Default Description"
|
||||
align = 1
|
||||
valign = 1
|
||||
autowrap = true
|
||||
|
||||
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
|
||||
"anims/Drop Off" = SubResource( 10 )
|
||||
"anims/Fly Off" = SubResource( 7 )
|
||||
anims/Hovering = SubResource( 11 )
|
||||
anims/RESET = SubResource( 8 )
|
||||
|
26
UI/DiceContainer.tscn
Normal file
@ -0,0 +1,26 @@
|
||||
[gd_scene load_steps=4 format=2]
|
||||
|
||||
[ext_resource path="res://AutoGridContainer - Full Version/AutoGridContainer.tscn" type="PackedScene" id=1]
|
||||
[ext_resource path="res://UI/ItemContainer.gd" type="Script" id=2]
|
||||
[ext_resource path="res://UI/DiceView.tscn" type="PackedScene" id=3]
|
||||
|
||||
[node name="DiceContainer" type="Control"]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
script = ExtResource( 2 )
|
||||
item_view_scene = ExtResource( 3 )
|
||||
child_holder = NodePath("Margin/AutoGrid")
|
||||
character_property = "dice"
|
||||
view_property = "dice_value"
|
||||
|
||||
[node name="Margin" type="MarginContainer" parent="."]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
margin_left = 30.0
|
||||
margin_top = 30.0
|
||||
margin_right = -30.0
|
||||
margin_bottom = -30.0
|
||||
|
||||
[node name="AutoGrid" parent="Margin" instance=ExtResource( 1 )]
|
||||
margin_right = 1220.0
|
||||
margin_bottom = 660.0
|
22
UI/DiceView.gd
Normal file
@ -0,0 +1,22 @@
|
||||
tool
|
||||
extends Control
|
||||
|
||||
const dice_image_string = "res://Assets/Dice/Dice%s.png"
|
||||
const hovering_shader = preload("res://UI/RainbowOutline.tres")
|
||||
|
||||
export (int, 0, 6) var dice_value : int = 0
|
||||
export var hovering : bool setget set_hovering
|
||||
|
||||
|
||||
func set_hovering(new_value):
|
||||
hovering = new_value
|
||||
if hovering:
|
||||
self.material = hovering_shader
|
||||
else:
|
||||
self.material = null
|
||||
|
||||
|
||||
func _physics_process(_delta):
|
||||
self.texture = load(dice_image_string % dice_value)
|
||||
|
||||
|
15
UI/DiceView.tscn
Normal file
@ -0,0 +1,15 @@
|
||||
[gd_scene load_steps=3 format=2]
|
||||
|
||||
[ext_resource path="res://Assets/Dice/Dice6.png" type="Texture" id=1]
|
||||
[ext_resource path="res://UI/DiceView.gd" type="Script" id=2]
|
||||
|
||||
[node name="DiceView" type="TextureRect"]
|
||||
margin_right = 100.0
|
||||
margin_bottom = 100.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
texture = ExtResource( 1 )
|
||||
expand = true
|
||||
stretch_mode = 6
|
||||
script = ExtResource( 2 )
|
||||
dice_value = 6
|
30
UI/InputDiceView.gd
Normal file
@ -0,0 +1,30 @@
|
||||
tool
|
||||
extends Control
|
||||
|
||||
export var bold : bool setget set_bold
|
||||
|
||||
|
||||
func _process(_delta):
|
||||
|
||||
# update the pivot offset to make sure the object's animations
|
||||
# are always centered
|
||||
$Sprite.rect_pivot_offset = rect_size/2
|
||||
$Particles2D.position = rect_size/2
|
||||
|
||||
|
||||
func set_extra_info(text : String):
|
||||
$"%ExtraInfo".text = text
|
||||
|
||||
|
||||
func set_bold(is_bold : bool = true):
|
||||
if is_bold:
|
||||
$Sprite.texture = load("res://Assets/DiceInputBold.png")
|
||||
else:
|
||||
$Sprite.texture = load("res://Assets/DiceInput.png")
|
||||
|
||||
bold = is_bold
|
||||
|
||||
|
||||
func run_disappear_animation():
|
||||
$AnimationPlayer.play("Disappear")
|
||||
yield($AnimationPlayer, "animation_finished")
|
180
UI/InputDiceView.tscn
Normal file
@ -0,0 +1,180 @@
|
||||
[gd_scene load_steps=10 format=2]
|
||||
|
||||
[ext_resource path="res://Assets/Metropolis-font/Metropolis-SemiBold.ttf" type="DynamicFontData" id=1]
|
||||
[ext_resource path="res://Assets/DiceInput.png" type="Texture" id=2]
|
||||
[ext_resource path="res://UI/InputDiceView.gd" type="Script" id=3]
|
||||
|
||||
[sub_resource type="Curve" id=10]
|
||||
_data = [ Vector2( 0, 0.121591 ), 0.0, 4.0026, 0, 0, Vector2( 1, 0 ), -1.48166, 0.0, 0, 0 ]
|
||||
|
||||
[sub_resource type="CurveTexture" id=11]
|
||||
curve = SubResource( 10 )
|
||||
|
||||
[sub_resource type="ParticlesMaterial" id=12]
|
||||
lifetime_randomness = 0.12
|
||||
flag_disable_z = true
|
||||
direction = Vector3( 0, 0, 0 )
|
||||
spread = 180.0
|
||||
gravity = Vector3( 0, 0, 0 )
|
||||
initial_velocity = 44.59
|
||||
orbit_velocity = 0.56
|
||||
orbit_velocity_random = 0.48
|
||||
linear_accel = -1.37
|
||||
radial_accel = -11.78
|
||||
scale = 0.01
|
||||
scale_curve = SubResource( 11 )
|
||||
hue_variation = 0.03
|
||||
hue_variation_random = 1.0
|
||||
|
||||
[sub_resource type="DynamicFont" id=7]
|
||||
size = 64
|
||||
use_filter = true
|
||||
font_data = ExtResource( 1 )
|
||||
|
||||
[sub_resource type="Animation" id=8]
|
||||
resource_name = "Disappear"
|
||||
length = 0.8
|
||||
step = 0.01
|
||||
tracks/0/type = "value"
|
||||
tracks/0/path = NodePath("Sprite:rect_scale")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/keys = {
|
||||
"times": PoolRealArray( 0, 0.09, 0.11, 0.5 ),
|
||||
"transitions": PoolRealArray( 0.406125, 0.392292, 2.07053, 3.36359 ),
|
||||
"update": 0,
|
||||
"values": [ Vector2( 1, 1 ), Vector2( 1.2, 1.2 ), Vector2( 1.2, 1.2 ), Vector2( 1e-05, 1e-05 ) ]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/path = NodePath("Sprite:rect_rotation")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/keys = {
|
||||
"times": PoolRealArray( 0, 0.09, 0.11, 0.5 ),
|
||||
"transitions": PoolRealArray( 0.406125, 0.392292, 2.92817, 3.36359 ),
|
||||
"update": 0,
|
||||
"values": [ 0.0, 55.0, 55.0, -155.0 ]
|
||||
}
|
||||
tracks/2/type = "value"
|
||||
tracks/2/path = NodePath("Particles2D:emitting")
|
||||
tracks/2/interp = 1
|
||||
tracks/2/loop_wrap = true
|
||||
tracks/2/imported = false
|
||||
tracks/2/enabled = true
|
||||
tracks/2/keys = {
|
||||
"times": PoolRealArray( 0, 0.5 ),
|
||||
"transitions": PoolRealArray( 1, 1 ),
|
||||
"update": 1,
|
||||
"values": [ false, true ]
|
||||
}
|
||||
tracks/3/type = "value"
|
||||
tracks/3/path = NodePath("Sprite/ExtraInfo:modulate")
|
||||
tracks/3/interp = 1
|
||||
tracks/3/loop_wrap = true
|
||||
tracks/3/imported = false
|
||||
tracks/3/enabled = true
|
||||
tracks/3/keys = {
|
||||
"times": PoolRealArray( 0, 0.25 ),
|
||||
"transitions": PoolRealArray( 1, 1 ),
|
||||
"update": 0,
|
||||
"values": [ Color( 1, 1, 1, 1 ), Color( 1, 1, 1, 0 ) ]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id=9]
|
||||
length = 0.001
|
||||
tracks/0/type = "value"
|
||||
tracks/0/path = NodePath("Sprite:rect_scale")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/keys = {
|
||||
"times": PoolRealArray( 0 ),
|
||||
"transitions": PoolRealArray( 1 ),
|
||||
"update": 0,
|
||||
"values": [ Vector2( 1, 1 ) ]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/path = NodePath("Sprite:rect_rotation")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/keys = {
|
||||
"times": PoolRealArray( 0 ),
|
||||
"transitions": PoolRealArray( 1 ),
|
||||
"update": 0,
|
||||
"values": [ 0.0 ]
|
||||
}
|
||||
tracks/2/type = "value"
|
||||
tracks/2/path = NodePath("Particles2D:emitting")
|
||||
tracks/2/interp = 1
|
||||
tracks/2/loop_wrap = true
|
||||
tracks/2/imported = false
|
||||
tracks/2/enabled = true
|
||||
tracks/2/keys = {
|
||||
"times": PoolRealArray( 0 ),
|
||||
"transitions": PoolRealArray( 1 ),
|
||||
"update": 0,
|
||||
"values": [ false ]
|
||||
}
|
||||
tracks/3/type = "value"
|
||||
tracks/3/path = NodePath("Sprite/ExtraInfo:modulate")
|
||||
tracks/3/interp = 1
|
||||
tracks/3/loop_wrap = true
|
||||
tracks/3/imported = false
|
||||
tracks/3/enabled = true
|
||||
tracks/3/keys = {
|
||||
"times": PoolRealArray( 0 ),
|
||||
"transitions": PoolRealArray( 1 ),
|
||||
"update": 0,
|
||||
"values": [ Color( 1, 1, 1, 1 ) ]
|
||||
}
|
||||
|
||||
[node name="InputDiceView" type="Control"]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
rect_min_size = Vector2( 75, 75 )
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
script = ExtResource( 3 )
|
||||
|
||||
[node name="Particles2D" type="Particles2D" parent="."]
|
||||
position = Vector2( 640, 360 )
|
||||
scale = Vector2( 5, 5 )
|
||||
emitting = false
|
||||
amount = 6
|
||||
lifetime = 0.75
|
||||
one_shot = true
|
||||
speed_scale = 2.0
|
||||
process_material = SubResource( 12 )
|
||||
texture = ExtResource( 2 )
|
||||
|
||||
[node name="Sprite" type="TextureRect" parent="."]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
rect_pivot_offset = Vector2( 640, 360 )
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
texture = ExtResource( 2 )
|
||||
expand = true
|
||||
stretch_mode = 6
|
||||
|
||||
[node name="ExtraInfo" type="Label" parent="Sprite"]
|
||||
unique_name_in_owner = true
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
custom_colors/font_color = Color( 0, 0, 0, 1 )
|
||||
custom_fonts/font = SubResource( 7 )
|
||||
align = 1
|
||||
valign = 1
|
||||
|
||||
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
|
||||
anims/Disappear = SubResource( 8 )
|
||||
anims/RESET = SubResource( 9 )
|
80
UI/ItemContainer.gd
Normal file
@ -0,0 +1,80 @@
|
||||
extends Control
|
||||
|
||||
signal scene_finished
|
||||
signal scene_failed
|
||||
|
||||
var active : bool = false
|
||||
|
||||
export (PackedScene) var item_view_scene
|
||||
export (NodePath) var child_holder
|
||||
export (String) var character_property = "items"
|
||||
export (String) var view_property = "item"
|
||||
|
||||
var character : Character = Character.new() setget update_items_shown
|
||||
var item_views = []
|
||||
|
||||
var hovering_view : int = -1
|
||||
|
||||
func update_items_shown(new_character = null):
|
||||
|
||||
# allow the update item shown function to work with and without setget
|
||||
if new_character != null:
|
||||
character = new_character
|
||||
|
||||
# remove the old items
|
||||
for item_view in item_views:
|
||||
yield(item_view.item_view_remove(false), "completed")
|
||||
item_views = []
|
||||
|
||||
# add items the new items from the character
|
||||
for item in character.get(character_property):
|
||||
var new_item_view = item_view_scene.instance()
|
||||
new_item_view.set(view_property, item)
|
||||
get_node(child_holder).add_child(new_item_view)
|
||||
item_views.append(new_item_view)
|
||||
new_item_view.connect("item_view_removed", self, "remove_from_item_views")
|
||||
|
||||
|
||||
func remove_from_item_views(item_view):
|
||||
var to_remove : int = item_views.find(item_view)
|
||||
if to_remove != -1:
|
||||
item_views.remove(to_remove)
|
||||
|
||||
|
||||
func _physics_process(_delta):
|
||||
if not active:
|
||||
hovering_view = -1
|
||||
return
|
||||
|
||||
# set the hovering view if just selected
|
||||
if hovering_view == -1:
|
||||
hovering_view = 0
|
||||
item_views[hovering_view].hovering = false
|
||||
|
||||
# move the selection forward or backward the list depending on input
|
||||
if (Input.is_action_just_pressed("ui_down") or
|
||||
Input.is_action_just_pressed("ui_right")):
|
||||
|
||||
# disable hovering on the previous item
|
||||
item_views[hovering_view].hovering = false
|
||||
|
||||
# cycle forward
|
||||
hovering_view += 1
|
||||
if hovering_view >= len(item_views):
|
||||
hovering_view = 0
|
||||
|
||||
# enable hovering on the present item
|
||||
item_views[hovering_view].hovering = true
|
||||
|
||||
if (Input.is_action_just_pressed("ui_up") or
|
||||
Input.is_action_just_pressed("ui_left")):
|
||||
|
||||
item_views[hovering_view].hovering = false
|
||||
|
||||
hovering_view -= 1
|
||||
if hovering_view < 0:
|
||||
hovering_view = len(item_views) -1
|
||||
|
||||
item_views[hovering_view].hovering = true
|
||||
|
||||
|
75
UI/RainbowOutline.tres
Normal file
@ -0,0 +1,75 @@
|
||||
[gd_resource type="ShaderMaterial" load_steps=2 format=2]
|
||||
|
||||
[sub_resource type="Shader" id=1]
|
||||
code = "shader_type canvas_item;
|
||||
|
||||
uniform vec4 line_color : hint_color = vec4(1);
|
||||
uniform float line_thickness : hint_range(0, 50) = 1.0;
|
||||
|
||||
uniform bool rainbow = false; //Activate the rainbow or select you color
|
||||
uniform float line_scale : hint_range(0, 20) = 1.2; // thickness of the line
|
||||
uniform float frequency : hint_range(0.0, 2.0) = 0.5; // frequency of the rainbow
|
||||
uniform float light_offset : hint_range(0.00001, 1.0) = 0.5; // this offsets all color channels;
|
||||
uniform float alpha : hint_range(0.0, 1.0) = 1.0;
|
||||
|
||||
|
||||
void fragment() {
|
||||
vec2 size = TEXTURE_PIXEL_SIZE * line_thickness;
|
||||
|
||||
float outline = texture(TEXTURE, UV + vec2(-size.x, 0)).a;
|
||||
outline += texture(TEXTURE, UV + vec2(0, size.y)).a;
|
||||
|
||||
outline += texture(TEXTURE, UV + vec2(size.x, 0)).a;
|
||||
|
||||
outline += texture(TEXTURE, UV + vec2(0, -size.y)).a;
|
||||
|
||||
|
||||
outline += texture(TEXTURE, UV + vec2(-size.x, size.y)).a;
|
||||
|
||||
outline += texture(TEXTURE, UV + vec2(-size.x, size.y * 0.5)).a;
|
||||
|
||||
|
||||
|
||||
outline += texture(TEXTURE, UV + vec2(size.x, size.y)).a;
|
||||
outline += texture(TEXTURE, UV + vec2(size.x, size.y * 0.5)).a;
|
||||
|
||||
|
||||
outline += texture(TEXTURE, UV + vec2(-size.x, -size.y)).a;
|
||||
outline += texture(TEXTURE, UV + vec2(-size.x, -size.y * 0.5)).a;
|
||||
|
||||
|
||||
|
||||
outline += texture(TEXTURE, UV + vec2(size.x, -size.y)).a;
|
||||
outline += texture(TEXTURE, UV + vec2(size.x, -size.y * 0.5)).a;
|
||||
|
||||
|
||||
outline = min(outline, 1.0);
|
||||
|
||||
|
||||
vec4 color = texture(TEXTURE, UV);
|
||||
|
||||
vec4 animated_line_color = vec4(light_offset + sin(2.0*3.14*frequency*TIME),
|
||||
light_offset + sin(2.0*3.14*frequency*TIME + radians(120.0)),
|
||||
light_offset + sin(2.0*3.14*frequency*TIME + radians(240.0)),
|
||||
alpha);
|
||||
|
||||
|
||||
if (rainbow == true){//if rainbow is activated
|
||||
COLOR = mix(color, animated_line_color, outline - color.a);
|
||||
}
|
||||
if (rainbow == false){//if rainbow not is activated and you pick a color
|
||||
COLOR = mix(color, line_color , outline - color.a);
|
||||
}
|
||||
|
||||
// COLOR = mix(color, line_color, outline - color.a);
|
||||
}"
|
||||
|
||||
[resource]
|
||||
shader = SubResource( 1 )
|
||||
shader_param/line_color = Color( 1, 1, 1, 1 )
|
||||
shader_param/line_thickness = 35.0
|
||||
shader_param/rainbow = true
|
||||
shader_param/line_scale = 1.2
|
||||
shader_param/frequency = 0.25
|
||||
shader_param/light_offset = 0.5
|
||||
shader_param/alpha = 1.0
|
@ -8,15 +8,50 @@
|
||||
|
||||
config_version=4
|
||||
|
||||
_global_script_classes=[ {
|
||||
"base": "Node",
|
||||
"class": "Card",
|
||||
"language": "GDScript",
|
||||
"path": "res://UI/Card.gd"
|
||||
}, {
|
||||
"base": "Resource",
|
||||
"class": "CardResource",
|
||||
"language": "GDScript",
|
||||
"path": "res://Assets/CardDB/CardBD.gd"
|
||||
}, {
|
||||
"base": "Node2D",
|
||||
"class": "Character",
|
||||
"language": "GDScript",
|
||||
"path": "res://Characters/Character.gd"
|
||||
} ]
|
||||
_global_script_class_icons={
|
||||
"Card": "",
|
||||
"CardResource": "",
|
||||
"Character": ""
|
||||
}
|
||||
|
||||
[application]
|
||||
|
||||
config/name="Quit Rolling Around"
|
||||
run/main_scene="res://Scenes/BattleScene.tscn"
|
||||
config/icon="res://icon.png"
|
||||
|
||||
[autoload]
|
||||
|
||||
Global="*res://Global.gd"
|
||||
|
||||
[display]
|
||||
|
||||
window/size/width=1280
|
||||
window/size/height=720
|
||||
window/stretch/mode="2d"
|
||||
window/stretch/aspect="keep_width"
|
||||
|
||||
[physics]
|
||||
|
||||
common/enable_pause_aware_picking=true
|
||||
|
||||
[rendering]
|
||||
|
||||
quality/driver/fallback_to_gles2=true
|
||||
environment/default_environment="res://default_env.tres"
|
||||
|