Ver código fonte

Start of a player GUI

master
Bryan Miller 4 anos atrás
pai
commit
a7dca0ac22
11 arquivos alterados com 221 adições e 5 exclusões
  1. +3
    -0
      .import/Progress_Back.png-8b52df038e991164a0842785fe0717ad.md5
  2. BIN
      .import/Progress_Back.png-8b52df038e991164a0842785fe0717ad.stex
  3. +3
    -0
      .import/Progress_Bar.png-fa7ab2ffd51964180a7166e79be8e7fd.md5
  4. BIN
      .import/Progress_Bar.png-fa7ab2ffd51964180a7166e79be8e7fd.stex
  5. BIN
      Data/Graphics/UI/Progress_Back.png
  6. +34
    -0
      Data/Graphics/UI/Progress_Back.png.import
  7. BIN
      Data/Graphics/UI/Progress_Bar.png
  8. +34
    -0
      Data/Graphics/UI/Progress_Bar.png.import
  9. +2
    -2
      Data/Objects/Liquid.tscn
  10. +114
    -3
      Data/Scenes/World.tscn
  11. +31
    -0
      Data/Scripts/UI/GUI.gd

+ 3
- 0
.import/Progress_Back.png-8b52df038e991164a0842785fe0717ad.md5 Ver arquivo

@@ -0,0 +1,3 @@
source_md5="7552428db33cabf70bb16d29bec1c65a"
dest_md5="996d6cd10b5e1c0d93b7798e69b28cf4"


BIN
.import/Progress_Back.png-8b52df038e991164a0842785fe0717ad.stex Ver arquivo


+ 3
- 0
.import/Progress_Bar.png-fa7ab2ffd51964180a7166e79be8e7fd.md5 Ver arquivo

@@ -0,0 +1,3 @@
source_md5="1f6da12fb87e2090c4f17061417d6200"
dest_md5="020ae0fb640b63e7a551b3b11b1ff6ad"


BIN
.import/Progress_Bar.png-fa7ab2ffd51964180a7166e79be8e7fd.stex Ver arquivo


BIN
Data/Graphics/UI/Progress_Back.png Ver arquivo

Antes Depois
Largura: 256  |  Altura: 24  |  Tamanho: 328B

+ 34
- 0
Data/Graphics/UI/Progress_Back.png.import Ver arquivo

@@ -0,0 +1,34 @@
[remap]

importer="texture"
type="StreamTexture"
path="res://.import/Progress_Back.png-8b52df038e991164a0842785fe0717ad.stex"
metadata={
"vram_texture": false
}

[deps]

source_file="res://Data/Graphics/UI/Progress_Back.png"
dest_files=[ "res://.import/Progress_Back.png-8b52df038e991164a0842785fe0717ad.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=false
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
stream=false
size_limit=0
detect_3d=false
svg/scale=1.0

BIN
Data/Graphics/UI/Progress_Bar.png Ver arquivo

Antes Depois
Largura: 256  |  Altura: 24  |  Tamanho: 200B

+ 34
- 0
Data/Graphics/UI/Progress_Bar.png.import Ver arquivo

@@ -0,0 +1,34 @@
[remap]

importer="texture"
type="StreamTexture"
path="res://.import/Progress_Bar.png-fa7ab2ffd51964180a7166e79be8e7fd.stex"
metadata={
"vram_texture": false
}

[deps]

source_file="res://Data/Graphics/UI/Progress_Bar.png"
dest_files=[ "res://.import/Progress_Bar.png-fa7ab2ffd51964180a7166e79be8e7fd.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=false
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
stream=false
size_limit=0
detect_3d=false
svg/scale=1.0

+ 2
- 2
Data/Objects/Liquid.tscn Ver arquivo

@@ -9,8 +9,8 @@ resource_local_to_scene = true
shader = ExtResource( 3 )
shader_param/sprite_scale = Vector2( 2.96, 1 )
shader_param/distortion = 16.265
shader_param/liquid_color_main = Color( 0.180908, 0.250748, 0.8125, 1 )
shader_param/liquid_color_surface = Color( 0.576471, 0.760784, 0.996078, 1 )
shader_param/liquid_color_main = Color( 0, 0, 0, 1 )
shader_param/liquid_color_surface = Color( 0, 0, 0, 1 )
shader_param/liquid_surface_thickness = 0.12
shader_param/wave_amp = 0.25
shader_param/wave_freq = 1.0

+ 114
- 3
Data/Scenes/World.tscn Ver arquivo

@@ -1,4 +1,4 @@
[gd_scene load_steps=10 format=2]
[gd_scene load_steps=13 format=2]

[ext_resource path="res://Data/Objects/Pusher.tscn" type="PackedScene" id=1]
[ext_resource path="res://Data/Objects/Player.tscn" type="PackedScene" id=2]
@@ -7,14 +7,17 @@
[ext_resource path="res://Data/Objects/BladeSaw.tscn" type="PackedScene" id=5]
[ext_resource path="res://Data/Objects/Doorway.tscn" type="PackedScene" id=6]
[ext_resource path="res://Data/Misc/Tileset.tres" type="TileSet" id=7]
[ext_resource path="res://Data/Graphics/UI/Progress_Back.png" type="Texture" id=8]
[ext_resource path="res://Data/Graphics/UI/Progress_Bar.png" type="Texture" id=9]
[ext_resource path="res://Data/Scripts/UI/GUI.gd" type="Script" id=10]

[sub_resource type="ShaderMaterial" id=1]
resource_local_to_scene = true
shader = ExtResource( 4 )
shader_param/sprite_scale = Vector2( 2.96, 1 )
shader_param/distortion = 16.265
shader_param/liquid_color_main = Color( 0.180908, 0.250748, 0.8125, 1 )
shader_param/liquid_color_surface = Color( 0.576471, 0.760784, 0.996078, 1 )
shader_param/liquid_color_main = Color( 0.513726, 0.137255, 0.137255, 1 )
shader_param/liquid_color_surface = Color( 0.984314, 0.478431, 0.490196, 1 )
shader_param/liquid_surface_thickness = 0.12
shader_param/wave_amp = 0.25
shader_param/wave_freq = 1.0
@@ -78,3 +81,111 @@ tile_data = PoolIntArray( -393207, 1, 0, -393206, 1, 1, -393205, 1, 2, -262145,

[node name="Player" parent="." instance=ExtResource( 2 )]
position = Vector2( -32.4329, -11.6956 )

[node name="GUI" type="CanvasLayer" parent="."]
script = ExtResource( 10 )

[node name="PlayerUI" type="Control" parent="GUI"]
margin_right = 40.0
margin_bottom = 40.0
__meta__ = {
"_edit_use_anchors_": false
}

[node name="MoodBars" type="VBoxContainer" parent="GUI/PlayerUI"]
margin_left = 10.0
margin_top = 10.0
margin_right = -10.0
margin_bottom = -10.0
__meta__ = {
"_edit_use_anchors_": false
}

[node name="Aggression" type="VBoxContainer" parent="GUI/PlayerUI/MoodBars"]
margin_right = 256.0
margin_bottom = 42.0

[node name="Label" type="Label" parent="GUI/PlayerUI/MoodBars/Aggression"]
margin_right = 256.0
margin_bottom = 14.0
text = "Aggression"

[node name="Bar" type="TextureRect" parent="GUI/PlayerUI/MoodBars/Aggression"]
margin_top = 18.0
margin_right = 256.0
margin_bottom = 42.0
rect_min_size = Vector2( 256, 24 )
texture = ExtResource( 8 )

[node name="Progress" type="TextureProgress" parent="GUI/PlayerUI/MoodBars/Aggression/Bar"]
modulate = Color( 1, 0, 0, 1 )
margin_right = 256.0
margin_bottom = 24.0
rect_min_size = Vector2( 256, 24 )
value = 70.0
texture_progress = ExtResource( 9 )
__meta__ = {
"_edit_use_anchors_": false
}

[node name="Tween" type="Tween" parent="GUI/PlayerUI/MoodBars/Aggression/Bar/Progress"]

[node name="Neediness" type="VBoxContainer" parent="GUI/PlayerUI/MoodBars"]
margin_top = 46.0
margin_right = 256.0
margin_bottom = 88.0

[node name="Label" type="Label" parent="GUI/PlayerUI/MoodBars/Neediness"]
margin_right = 256.0
margin_bottom = 14.0
text = "Neediness"

[node name="Bar" type="TextureRect" parent="GUI/PlayerUI/MoodBars/Neediness"]
margin_top = 18.0
margin_right = 256.0
margin_bottom = 42.0
rect_min_size = Vector2( 256, 24 )
texture = ExtResource( 8 )

[node name="Progress" type="TextureProgress" parent="GUI/PlayerUI/MoodBars/Neediness/Bar"]
modulate = Color( 0.0784314, 1, 0, 1 )
margin_right = 256.0
margin_bottom = 24.0
rect_min_size = Vector2( 256, 24 )
value = 70.0
texture_progress = ExtResource( 9 )
__meta__ = {
"_edit_use_anchors_": false
}

[node name="Tween" type="Tween" parent="GUI/PlayerUI/MoodBars/Neediness/Bar/Progress"]

[node name="Contentment" type="VBoxContainer" parent="GUI/PlayerUI/MoodBars"]
margin_top = 92.0
margin_right = 256.0
margin_bottom = 134.0

[node name="Label" type="Label" parent="GUI/PlayerUI/MoodBars/Contentment"]
margin_right = 256.0
margin_bottom = 14.0
text = "Neediness"

[node name="Bar" type="TextureRect" parent="GUI/PlayerUI/MoodBars/Contentment"]
margin_top = 18.0
margin_right = 256.0
margin_bottom = 42.0
rect_min_size = Vector2( 256, 24 )
texture = ExtResource( 8 )

[node name="Progress" type="TextureProgress" parent="GUI/PlayerUI/MoodBars/Contentment/Bar"]
modulate = Color( 0, 0.0627451, 1, 1 )
margin_right = 256.0
margin_bottom = 24.0
rect_min_size = Vector2( 256, 24 )
value = 70.0
texture_progress = ExtResource( 9 )
__meta__ = {
"_edit_use_anchors_": false
}

[node name="Tween" type="Tween" parent="GUI/PlayerUI/MoodBars/Contentment/Bar/Progress"]

+ 31
- 0
Data/Scripts/UI/GUI.gd Ver arquivo

@@ -0,0 +1,31 @@
extends CanvasLayer

onready var _agg_bar = get_node("PlayerUI/MoodBars/Aggression/Bar/Progress")
onready var _agg_bar_tween = get_node("PlayerUI/MoodBars/Aggression/Bar/Progress/Tween")
onready var _need_bar = get_node("PlayerUI/MoodBars/Neediness/Bar/Progress")
onready var _need_bar_tween = get_node("PlayerUI/MoodBars/Neediness/Bar/Progress/Tween")
onready var _content_bar = get_node("PlayerUI/MoodBars/Contentment/Bar/Progress")
onready var _content_bar_tween = get_node("PlayerUI/MoodBars/Contentment/Bar/Progress/Tween")

# Called when the node enters the scene tree for the first time.
func _ready():
set_process(true)
_agg_bar.max_value = 100.0
_agg_bar.value = 0.0
_need_bar.max_value = 100.0
_need_bar.value = 0.0
_content_bar.max_value = 100.0
_content_bar.value = 0.0


func _process(delta):
UpdateMoodBars()

func UpdateMoodBars():
var mc = get_node("../Player").get_mood().get_mood_color()
_agg_bar_tween.interpolate_property(_agg_bar, "value", _agg_bar.value, mc.r * 100, 0.1, Tween.TRANS_LINEAR, Tween.EASE_IN_OUT)
_agg_bar_tween.start()
_need_bar_tween.interpolate_property(_need_bar, "value", _need_bar.value, mc.g * 100, 0.1, Tween.TRANS_LINEAR, Tween.EASE_IN_OUT)
_need_bar_tween.start()
_content_bar_tween.interpolate_property(_content_bar, "value", _content_bar.value, mc.b * 100, 0.1, Tween.TRANS_LINEAR, Tween.EASE_IN_OUT)
_content_bar_tween.start()

Carregando…
Cancelar
Salvar