Compare commits
3 Commits
7b5d7f5ee7
...
e2db1fef29
Author | SHA1 | Date | |
---|---|---|---|
e2db1fef29 | |||
c4b483b2a1 | |||
e78931e55e |
3
.gitignore
vendored
@ -11,3 +11,6 @@ export_presets.cfg
|
||||
.mono/
|
||||
data_*/
|
||||
|
||||
# Krita
|
||||
*.png~
|
||||
*.kra~
|
||||
|
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 |
@ -6,6 +6,23 @@ var player_to_move : bool = false
|
||||
var player_original_position : Vector2 = Vector2.ZERO
|
||||
var player_movement_range = 5
|
||||
|
||||
|
||||
func _ready():
|
||||
# start with the DiceView being selected
|
||||
$UI/DiceView.selected = true
|
||||
$UI/CardView.selected = false
|
||||
self.player_to_move = false
|
||||
|
||||
$UI/DiceView.roll_dice()
|
||||
$UI/DiceView.roll_dice()
|
||||
$UI/DiceView.roll_dice()
|
||||
|
||||
|
||||
func set_player_to_move(movement_range : int = 0):
|
||||
player_to_move = true
|
||||
player_movement_range = movement_range
|
||||
|
||||
|
||||
func _physics_process(delta):
|
||||
|
||||
# player should carry on queued movements no matter what
|
||||
|
13
UI/Dice.gd
@ -2,8 +2,19 @@ tool
|
||||
extends Control
|
||||
|
||||
const dice_image_string = "res://Assets/Dice/Dice%s.png"
|
||||
const selected_shader = preload("res://UI/RainbowOutline.tres")
|
||||
|
||||
export (int, 1, 6) var dice_value : int setget _set_dice_value
|
||||
export var selected : bool setget _set_selected
|
||||
|
||||
|
||||
func _set_selected(new_value):
|
||||
selected = new_value
|
||||
if selected:
|
||||
self.material = selected_shader
|
||||
else:
|
||||
self.material = null
|
||||
|
||||
|
||||
func _set_dice_value(new_value):
|
||||
dice_value = new_value
|
||||
@ -14,3 +25,5 @@ func _ready():
|
||||
randomize()
|
||||
|
||||
self.dice_value = int(round(rand_range(0.5, 6.49999999)))
|
||||
|
||||
|
||||
|
@ -2,10 +2,47 @@ extends Control
|
||||
|
||||
const dice = preload("res://UI/Dice.tscn")
|
||||
|
||||
var selected : bool = true
|
||||
var selected : bool = false
|
||||
var selected_dice = null
|
||||
|
||||
var current_dice = []
|
||||
|
||||
|
||||
func _physics_process(delta):
|
||||
|
||||
# no keyboard input if not selected
|
||||
if not selected:
|
||||
selected_dice = null
|
||||
return
|
||||
|
||||
# if selected dice is null, add a value
|
||||
if not selected_dice:
|
||||
selected_dice = 0
|
||||
|
||||
# TODO: maybe support actual dicrectional selection
|
||||
# move the selection forward or backward the list depending on input
|
||||
if (Input.is_action_just_pressed("ui_up") or
|
||||
Input.is_action_just_pressed("ui_left")):
|
||||
|
||||
current_dice[selected_dice].selected = false
|
||||
|
||||
selected_dice += 1
|
||||
if selected_dice >= len(current_dice):
|
||||
selected_dice = 0
|
||||
|
||||
if (Input.is_action_just_pressed("ui_down") or
|
||||
Input.is_action_just_pressed("ui_right")):
|
||||
|
||||
current_dice[selected_dice].selected = false
|
||||
|
||||
selected_dice -= 1
|
||||
if selected_dice < 0:
|
||||
selected_dice = len(current_dice) -1
|
||||
|
||||
# enable the selected shader
|
||||
current_dice[selected_dice].selected = true
|
||||
|
||||
|
||||
func roll_dice(specific_value : int = 0):
|
||||
# make a new dice instance and add it to the grid container
|
||||
var new_dice = dice.instance()
|
||||
|
@ -1,10 +1,7 @@
|
||||
[gd_scene load_steps=6 format=2]
|
||||
[gd_scene load_steps=3 format=2]
|
||||
|
||||
[ext_resource path="res://AutoGridContainer - Full Version/AutoGridContainer.tscn" type="PackedScene" id=1]
|
||||
[ext_resource path="res://UI/DiceView.gd" type="Script" id=2]
|
||||
[ext_resource path="res://UI/Dice.tscn" type="PackedScene" id=3]
|
||||
[ext_resource path="res://Assets/Dice/Dice6.png" type="Texture" id=4]
|
||||
[ext_resource path="res://Assets/Dice/Dice1.png" type="Texture" id=5]
|
||||
|
||||
[node name="DiceView" type="Control"]
|
||||
anchor_right = 1.0
|
||||
@ -22,19 +19,3 @@ margin_bottom = -30.0
|
||||
[node name="AutoGrid" parent="Margin" instance=ExtResource( 1 )]
|
||||
margin_right = 1220.0
|
||||
margin_bottom = 660.0
|
||||
|
||||
[node name="Dice" parent="Margin/AutoGrid" instance=ExtResource( 3 )]
|
||||
texture = ExtResource( 5 )
|
||||
dice_value = 1
|
||||
|
||||
[node name="Dice2" parent="Margin/AutoGrid" instance=ExtResource( 3 )]
|
||||
texture = ExtResource( 5 )
|
||||
dice_value = 1
|
||||
|
||||
[node name="Dice3" parent="Margin/AutoGrid" instance=ExtResource( 3 )]
|
||||
texture = ExtResource( 5 )
|
||||
dice_value = 1
|
||||
|
||||
[node name="Dice4" parent="Margin/AutoGrid" instance=ExtResource( 3 )]
|
||||
texture = ExtResource( 4 )
|
||||
dice_value = 6
|
||||
|
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
|