Compare commits

..

82 Commits

Author SHA1 Message Date
a6bc483e63 Merge pull request 'Completely refractor the project so the code isn't so terrible' (#7) from card-rework into main
Reviewed-on: https://gitea.doserver.duckdns.org/CactiChameleon9/Quit-Rolling-Around-gmtk-jam-2022/pulls/7
2022-08-24 09:51:58 +01:00
c96ac0e2d2 Basic battle scene layout 2022-08-24 09:45:23 +01:00
bf15a8a824 Add support for hovering with the DiceView 2022-08-24 09:44:17 +01:00
41c2689e1f Add new hovering function to the itemcontainer 2022-08-24 09:16:30 +01:00
a2185e081c Redo basic DiceController with new generic ItemController 2022-08-17 21:02:03 +01:00
ea2dde50e3 Make the CardContainer.gd generic 2022-08-15 08:32:40 +01:00
59bec36c08 Basic half-baked attempt at new battle scene 2022-08-14 11:32:54 +01:00
a7256d56ed Partially fix the active controller 2022-08-14 11:24:48 +01:00
47f59a7a6d Add new Battle Scene for managing character movement and damage (pending) 2022-08-14 10:58:51 +01:00
2176c95417 Add scene_failed signal and fix the_connecting() 2022-08-14 08:56:42 +01:00
a0ad1442ad Remove TempBattle 2022-07-31 17:42:04 +01:00
d863e991bb Add the ActiveController 2022-07-31 17:35:44 +01:00
53462325c8 Improve card run animation 2022-07-30 15:35:51 +01:00
7040c0e09d Remove uneeded self vairable from remove_card signal 2022-07-29 21:30:52 +01:00
4f89e06066 Add support for the card_view_removed signal 2022-07-29 21:30:15 +01:00
5002893113 Add card_view_removed signal and fix a few bugs 2022-07-29 21:29:28 +01:00
40ccd28fb9 Implement basic CardContainer 2022-07-29 20:49:48 +01:00
349a1bf0d3 Add a remove animation and method 2022-07-26 09:57:58 +01:00
40fb724000 Add a few TODOs 2022-07-26 08:51:18 +01:00
87a5c280d6 Disable animation autorun 2022-07-26 08:48:47 +01:00
eb29b2ce44 Increase Disappear run length 2022-07-26 08:47:30 +01:00
288cd288e4 Run input dice disappear animation 2022-07-26 08:09:19 +01:00
3f2281a155 Add card_view_run method 2022-07-26 08:02:04 +01:00
5d0b1933b6 Add connect_signals method for CardView 2022-07-26 07:58:58 +01:00
321defe228 Add a card fly off animation 2022-07-26 07:52:58 +01:00
f019cdd1e3 Switch to use new Unique Names 2022-07-25 21:11:52 +01:00
f4b9d4718b Fix always being bold 2022-07-25 21:05:10 +01:00
c181c4f70b Change the font boldness 2022-07-25 20:45:54 +01:00
13ac881809 Add code support for bold input dice 2022-07-25 20:45:37 +01:00
8bd768ebdc Add bold input dice 2022-07-25 20:39:38 +01:00
5216632ee2 Basic Extra Info Support 2022-07-25 20:25:57 +01:00
e84ea6786c Better support Extra Info 2022-07-25 20:23:58 +01:00
7da22c2461 Add basic CardView implementation 2022-07-25 11:13:09 +01:00
a9b07decbf Make InputDiceView resize properly in an autogrid 2022-07-25 11:06:28 +01:00
eab9ca42f6 Make Card a class 2022-07-25 10:07:39 +01:00
67143708bc Add InputDiceView and disappear animation 2022-07-25 09:11:42 +01:00
238a04b460 Improve card.gd clarity 2022-07-24 21:13:34 +01:00
453330670b Remove UI logic from the card 2022-07-24 21:05:40 +01:00
6fda66c7e0 Rename Card to CardView to reflect purpose 2022-07-24 20:55:37 +01:00
e89eb7f15c Rename CardView to CardContainer to reflect purpose 2022-07-24 20:53:55 +01:00
69e00d25a3 Fix damage being dealt 2022-07-19 08:25:02 +01:00
c7ee498435 Fix sending uneeded damage and movement signals 2022-07-17 19:19:32 +01:00
2b92579dc3 Add support for "Placing" the dice and cleanup 2022-07-17 19:15:22 +01:00
78bfa30e0e Fix no default health 2022-07-17 19:08:13 +01:00
57ca632630 Show specific dice reqirements 2022-07-17 19:06:43 +01:00
8abb393949 Fix player reverting back to default position upon first move 2022-07-17 18:48:34 +01:00
c6d26f9b77 Use decimals instead of % 1 to find if int or float 2022-07-17 18:35:33 +01:00
b4e2f071df Fix card data lot loading visually 2022-07-17 18:30:28 +01:00
1e5fb13615 Implement taking damage 2022-07-17 18:30:05 +01:00
f2fad3bb0e Make a new Character class which both the enemy and player share 2022-07-17 18:23:41 +01:00
3ad8e574dd Fix starting positions for characters, add some groups, add enermies to battlescene 2022-07-17 17:37:01 +01:00
d0e99788fb Add a very basic enemy 2022-07-17 17:23:21 +01:00
6ec76a2988 Fix a few crashes to do with logic ordering 2022-07-17 17:11:43 +01:00
3df809aa9d Fix current_cards list not be updated upon card removal 2022-07-17 17:05:43 +01:00
6b2007ee1a Fix the movement amount calculation 2022-07-17 17:01:38 +01:00
a0ddbdae43 Fix Accepted Dice enum not corrisponding with actual dice numbers 2022-07-17 16:50:23 +01:00
b4f33f30b6 Setup signals to give information from running cards 2022-07-17 16:47:27 +01:00
08a265a14b Add support for return dice 2022-07-17 16:18:25 +01:00
634c9e9d30 Remove debug prints and fix cards not running with in range dice 2022-07-17 16:05:02 +01:00
5bd9d2efb3 Make selecting a dice do something to the CardView 2022-07-17 15:53:56 +01:00
929fc6291e Add dice_selected signal 2022-07-17 14:32:42 +01:00
e2db1fef29 Add selection shader to show selected dice 2022-07-17 14:25:56 +01:00
c4b483b2a1 Expand dice sizing to support outline shader 2022-07-17 14:25:21 +01:00
e78931e55e Add some input logic for diceview 2022-07-17 13:10:26 +01:00
7b5d7f5ee7 Get a tile for the tilemap of the correct size 2022-07-17 08:35:26 +01:00
862fb41a32 Plumb the basics of input control and limit player movement to range 2022-07-16 23:56:52 +01:00
e9adc58583 Fix a lost precision warning 2022-07-16 22:58:24 +01:00
219921d51b Fix returning dice1 twice 2022-07-16 22:57:52 +01:00
5d638e3f5b Keep aspect ratio on UI so horizontal stretching looks fine 2022-07-16 22:55:03 +01:00
2dc7dfc3f6 Fix running on raspi 2022-07-16 22:54:09 +01:00
12525b0095 Change resolution to 720p and add UI to BattleScene 2022-07-16 21:35:09 +01:00
e52716c793 Add dice and diceview 2022-07-16 21:33:47 +01:00
70c4ba38e2 Fix not changing the addition_dice_amount with setget 2022-07-16 21:33:02 +01:00
051cc25a38 Tweak a few things and add CardView to the battlescene 2022-07-16 19:16:51 +01:00
6a6e74efa8 Add UI support for addition dice, remove card once used 2022-07-16 16:12:32 +01:00
638bb9439a Add Utility effects implemtation 2022-07-16 16:00:51 +01:00
ce07155494 Implement more dice checks 2022-07-16 15:17:30 +01:00
f7de541341 Add support for inputting dice and vairable amounts inputs 2022-07-16 14:37:51 +01:00
47025af8c5 Add a range parameter and make some more interesting cards 2022-07-16 14:36:21 +01:00
8bf99ecae1 Tweak Card UI 2022-07-16 14:34:51 +01:00
acf8506a22 Improve Card Visuals 2022-07-16 13:50:18 +01:00
dca0def350 Add New Card Resouce Type 2022-07-16 12:07:03 +01:00
83 changed files with 1662 additions and 156 deletions

3
.gitignore vendored
View File

@ -11,3 +11,6 @@ export_presets.cfg
.mono/
data_*/
# Krita
*.png~
*.kra~

View 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
View 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 = ""

View 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"

View 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"

View 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
View 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"

Binary file not shown.

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 62 KiB

After

Width:  |  Height:  |  Size: 64 KiB

View File

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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 57 KiB

After

Width:  |  Height:  |  Size: 62 KiB

Binary file not shown.

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 68 KiB

After

Width:  |  Height:  |  Size: 72 KiB

View File

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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 62 KiB

After

Width:  |  Height:  |  Size: 68 KiB

Binary file not shown.

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 73 KiB

After

Width:  |  Height:  |  Size: 76 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 65 KiB

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 70 KiB

After

Width:  |  Height:  |  Size: 73 KiB

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 69 KiB

After

Width:  |  Height:  |  Size: 72 KiB

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 74 KiB

After

Width:  |  Height:  |  Size: 77 KiB

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

BIN
Assets/DiceInputBold.kra Normal file

Binary file not shown.

BIN
Assets/DiceInputBold.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 72 KiB

View 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

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
Assets/TestTile.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

View 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

View 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

View 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
View 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
View File

@ -0,0 +1 @@
extends Character

11
Characters/Enemy.tscn Normal file
View 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 )

View File

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

View File

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

@ -0,0 +1,15 @@
extends Node
enum EFFECT {
POISON
BURN
CONFUSION
WEAKNESS
SPLIT
DOUBLE
HALF
FLIP
DUPLICATE
REROLL
}

View 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

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

View File

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

View File

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

View File

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

View File

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

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

136
UI/CardView.gd Normal file
View 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")

View File

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

View File

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