瀏覽代碼

Continuing to build out the UI

master
Bryan Miller 4 年之前
父節點
當前提交
ea755dd9cb
共有 15 個文件被更改,包括 216 次插入40 次删除
  1. +3
    -0
      .import/Progress_Back_H.png-154c341c3b0b1e63c366c566a4ad3d43.md5
  2. 二進制
      .import/Progress_Back_H.png-154c341c3b0b1e63c366c566a4ad3d43.stex
  3. +3
    -0
      .import/Progress_Bar_H.png-d6e07a97ba5a7e6f00f81b602acc33f2.md5
  4. 二進制
      .import/Progress_Bar_H.png-d6e07a97ba5a7e6f00f81b602acc33f2.stex
  5. +8
    -0
      Data/Fonts/Hydrogen_64.tres
  6. +9
    -0
      Data/Fonts/Killer_Robot_20.tres
  7. 二進制
      Data/Fonts/Robot Killer.ttf
  8. 二進制
      Data/Fonts/hydroge2.ttf
  9. 二進制
      Data/Graphics/UI/Progress_Back_H.png
  10. +34
    -0
      Data/Graphics/UI/Progress_Back_H.png.import
  11. 二進制
      Data/Graphics/UI/Progress_Bar_H.png
  12. +34
    -0
      Data/Graphics/UI/Progress_Bar_H.png.import
  13. +103
    -30
      Data/Scenes/World.tscn
  14. +11
    -9
      Data/Scripts/Controller.gd
  15. +11
    -1
      Data/Scripts/UI/GUI.gd

+ 3
- 0
.import/Progress_Back_H.png-154c341c3b0b1e63c366c566a4ad3d43.md5 查看文件

@@ -0,0 +1,3 @@
source_md5="2a74bea5155f01c1f2c885275f294847"
dest_md5="8d137aaf639aa92772a4b79eb90cb60a"


二進制
.import/Progress_Back_H.png-154c341c3b0b1e63c366c566a4ad3d43.stex 查看文件


+ 3
- 0
.import/Progress_Bar_H.png-d6e07a97ba5a7e6f00f81b602acc33f2.md5 查看文件

@@ -0,0 +1,3 @@
source_md5="c9986d12b675cea6a80493423d5d121a"
dest_md5="8c1cfa8cac7f2b7e48185138386d3b20"


二進制
.import/Progress_Bar_H.png-d6e07a97ba5a7e6f00f81b602acc33f2.stex 查看文件


+ 8
- 0
Data/Fonts/Hydrogen_64.tres 查看文件

@@ -0,0 +1,8 @@
[gd_resource type="DynamicFont" load_steps=2 format=2]

[ext_resource path="res://Data/Fonts/hydroge2.ttf" type="DynamicFontData" id=1]

[resource]
size = 64
outline_color = Color( 0, 0, 0, 1 )
font_data = ExtResource( 1 )

+ 9
- 0
Data/Fonts/Killer_Robot_20.tres 查看文件

@@ -0,0 +1,9 @@
[gd_resource type="DynamicFont" load_steps=2 format=2]

[ext_resource path="res://Data/Fonts/Robot Killer.ttf" type="DynamicFontData" id=1]

[resource]
size = 20
outline_size = 1
outline_color = Color( 0, 0, 0, 1 )
font_data = ExtResource( 1 )

二進制
Data/Fonts/Robot Killer.ttf 查看文件


二進制
Data/Fonts/hydroge2.ttf 查看文件


二進制
Data/Graphics/UI/Progress_Back_H.png 查看文件

Before After
Width: 24  |  Height: 118  |  Size: 282B

+ 34
- 0
Data/Graphics/UI/Progress_Back_H.png.import 查看文件

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

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

[deps]

source_file="res://Data/Graphics/UI/Progress_Back_H.png"
dest_files=[ "res://.import/Progress_Back_H.png-154c341c3b0b1e63c366c566a4ad3d43.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

二進制
Data/Graphics/UI/Progress_Bar_H.png 查看文件

Before After
Width: 24  |  Height: 118  |  Size: 180B

+ 34
- 0
Data/Graphics/UI/Progress_Bar_H.png.import 查看文件

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

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

[deps]

source_file="res://Data/Graphics/UI/Progress_Bar_H.png"
dest_files=[ "res://.import/Progress_Bar_H.png-d6e07a97ba5a7e6f00f81b602acc33f2.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

+ 103
- 30
Data/Scenes/World.tscn 查看文件

@@ -1,4 +1,4 @@
[gd_scene load_steps=13 format=2]
[gd_scene load_steps=17 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]
@@ -10,11 +10,15 @@
[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]
[ext_resource path="res://Data/Graphics/UI/Progress_Bar_H.png" type="Texture" id=11]
[ext_resource path="res://Data/Graphics/UI/Progress_Back_H.png" type="Texture" id=12]
[ext_resource path="res://Data/Fonts/Killer_Robot_20.tres" type="DynamicFont" id=13]
[ext_resource path="res://Data/Fonts/Hydrogen_64.tres" type="DynamicFont" id=14]

[sub_resource type="ShaderMaterial" id=1]
resource_local_to_scene = true
shader = ExtResource( 4 )
shader_param/sprite_scale = Vector2( 2.96, 1 )
shader_param/sprite_scale = Vector2( 2.35979, 1.50659 )
shader_param/distortion = 16.265
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 )
@@ -26,7 +30,7 @@ shader_param/wave_scale = 1.0
[sub_resource type="ShaderMaterial" id=2]
resource_local_to_scene = true
shader = ExtResource( 4 )
shader_param/sprite_scale = Vector2( 2.96, 1 )
shader_param/sprite_scale = Vector2( 1.66713, 1.11691 )
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 )
@@ -37,43 +41,45 @@ shader_param/wave_scale = 1.0

[node name="World" type="Node2D"]

[node name="Liquid2" parent="." instance=ExtResource( 3 )]
[node name="Level_00" type="Node2D" parent="."]

[node name="Liquid2" parent="Level_00" instance=ExtResource( 3 )]
material = SubResource( 1 )
position = Vector2( -127.435, 105.962 )
scale = Vector2( 2.35979, 1.50659 )
liquid_body_color = Color( 0.513726, 0.137255, 0.137255, 1 )
liquid_surface_color = Color( 0.984314, 0.478431, 0.490196, 1 )

[node name="Liquid" parent="." instance=ExtResource( 3 )]
[node name="Liquid" parent="Level_00" instance=ExtResource( 3 )]
material = SubResource( 2 )
position = Vector2( 539.108, -23.1772 )
scale = Vector2( 1.66713, 1.11691 )
liquid_body_color = Color( 0.180908, 0.250748, 0.8125, 1 )
liquid_surface_color = Color( 0.576471, 0.760784, 0.996078, 1 )

[node name="Doorway" parent="." instance=ExtResource( 6 )]
[node name="Doorway" parent="Level_00" instance=ExtResource( 6 )]
position = Vector2( 94.9786, 581.025 )
color = Color( 0.0470588, 0.0156863, 0.980392, 1 )

[node name="Doorway2" parent="." instance=ExtResource( 6 )]
[node name="Doorway2" parent="Level_00" instance=ExtResource( 6 )]
position = Vector2( -306.381, 286.254 )
rotation = 1.57079
color = Color( 0.0235294, 0.980392, 0.0156863, 1 )

[node name="BladeSaw" parent="." instance=ExtResource( 5 )]
[node name="BladeSaw" parent="Level_00" instance=ExtResource( 5 )]
position = Vector2( -389.595, -64.0996 )

[node name="BladeSaw2" parent="." instance=ExtResource( 5 )]
[node name="BladeSaw2" parent="Level_00" instance=ExtResource( 5 )]
position = Vector2( -298.686, -133.59 )
degrees_per_second = -270.0

[node name="Pusher" parent="." instance=ExtResource( 1 )]
[node name="Pusher" parent="Level_00" instance=ExtResource( 1 )]
position = Vector2( 108.94, -32.8218 )
pulse_color = Color( 0.980392, 0.980392, 0.74902, 1 )
push_force = 128.0
push_angle = 34.923

[node name="TileMap" type="TileMap" parent="."]
[node name="TileMap" type="TileMap" parent="Level_00"]
tile_set = ExtResource( 7 )
collision_layer = 2
format = 1
@@ -85,35 +91,73 @@ position = Vector2( -32.4329, -11.6956 )
[node name="GUI" type="CanvasLayer" parent="."]
script = ExtResource( 10 )

[node name="PlayerUI" type="Control" parent="GUI"]
[node name="PlayerUI" type="HBoxContainer" parent="GUI"]
margin_left = 10.0
margin_top = 10.0
margin_right = 40.0
margin_bottom = 40.0
custom_constants/separation = 14
__meta__ = {
"_edit_use_anchors_": false
}

[node name="NRG" type="VBoxContainer" parent="GUI/PlayerUI"]
margin_right = 41.0
margin_bottom = 164.0

[node name="Label" type="Label" parent="GUI/PlayerUI/NRG"]
margin_right = 41.0
margin_bottom = 24.0
custom_fonts/font = ExtResource( 13 )
text = "NRG"

[node name="Bar" type="TextureRect" parent="GUI/PlayerUI/NRG"]
margin_top = 28.0
margin_right = 41.0
margin_bottom = 146.0
texture = ExtResource( 12 )
stretch_mode = 4

[node name="Progress" type="TextureProgress" parent="GUI/PlayerUI/NRG/Bar"]
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
margin_left = -12.0
margin_top = -59.0
margin_right = 12.0
margin_bottom = 59.0
value = 70.0
texture_progress = ExtResource( 11 )
fill_mode = 3
__meta__ = {
"_edit_use_anchors_": false
}

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

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

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

[node name="Label" type="Label" parent="GUI/PlayerUI/MoodBars/Aggression"]
margin_right = 256.0
margin_bottom = 14.0
margin_bottom = 24.0
custom_fonts/font = ExtResource( 13 )
text = "Aggression"

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

@@ -131,19 +175,20 @@ __meta__ = {
[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_top = 56.0
margin_right = 256.0
margin_bottom = 88.0
margin_bottom = 108.0

[node name="Label" type="Label" parent="GUI/PlayerUI/MoodBars/Neediness"]
margin_right = 256.0
margin_bottom = 14.0
margin_bottom = 24.0
custom_fonts/font = ExtResource( 13 )
text = "Neediness"

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

@@ -161,19 +206,20 @@ __meta__ = {
[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_top = 112.0
margin_right = 256.0
margin_bottom = 134.0
margin_bottom = 164.0

[node name="Label" type="Label" parent="GUI/PlayerUI/MoodBars/Contentment"]
margin_right = 256.0
margin_bottom = 14.0
margin_bottom = 24.0
custom_fonts/font = ExtResource( 13 )
text = "Neediness"

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

@@ -189,3 +235,30 @@ __meta__ = {
}

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

[node name="VBoxContainer" type="VBoxContainer" parent="GUI"]
anchor_left = 1.0
anchor_right = 1.0
margin_left = -150.0
margin_top = 10.0
margin_right = -10.0
margin_bottom = 93.0
__meta__ = {
"_edit_use_anchors_": false
}

[node name="Label" type="Label" parent="GUI/VBoxContainer"]
margin_right = 140.0
margin_bottom = 24.0
custom_fonts/font = ExtResource( 13 )
custom_colors/font_color = Color( 0.886275, 1, 0.827451, 1 )
text = "Time Elapsed"

[node name="TimeText" type="Label" parent="GUI/VBoxContainer"]
margin_top = 28.0
margin_right = 140.0
margin_bottom = 93.0
custom_fonts/font = ExtResource( 14 )
custom_colors/font_color = Color( 0.368627, 0.368627, 0.368627, 1 )
custom_colors/font_color_shadow = Color( 1, 1, 1, 1 )
text = "0:00"

+ 11
- 9
Data/Scripts/Controller.gd 查看文件

@@ -4,8 +4,8 @@ const COLLISION_MINOR_SPEED_THRESHOLD = 150
const COLLISION_MAJOR_SPEED_THRESHOLD = 400
const COLLISION_TIMEDT_THRESHOLD = 0.1

export var max_stamina = 1000
export var stamina_regen_per_sec = 125
export var max_energy = 1000
export var energy_regen_per_sec = 125

# The base tangential acceleration that will be applied to the particles to give the
# player the illusion it's trying to move on it's own. This is just effects things visually (ATM)
@@ -13,10 +13,10 @@ export var base_tangential_accel = 32 setget _set_base_tangential_accel

# The base force applied when being pushed.
export var base_push_force = 64 setget _set_base_push_force
export var push_stamina_cost = 100
export var push_energy_cost = 100


var current_stamina = max_stamina
var current_energy = max_energy

# The maximum distance from the player in which the mouse will adjust the push force.
# at max_mouse_distance the full base_push_force <+ modifiers> will be applied.
@@ -88,6 +88,8 @@ func get_body_radius():
func get_mood():
return $Mood

func get_current_energy():
return current_energy

func _set_color_collision_mask(id):
set_collision_mask_bit(10, true)
@@ -117,8 +119,8 @@ func _input(event):
mouse_down = true
elif Input.is_action_just_released("ButtonA"):
mouse_down = false
if current_stamina >= push_stamina_cost:
current_stamina -= push_stamina_cost
if current_energy >= push_energy_cost:
current_energy -= push_energy_cost
push = true


@@ -145,9 +147,9 @@ func _physics_process(delta):
$Mood.shift_mood(delta, in_air, last_speed, (position - mouse_position).length())
last_speed = linear_velocity.length()
current_stamina += stamina_regen_per_sec * delta
if current_stamina > max_stamina:
current_stamina = max_stamina
current_energy += energy_regen_per_sec * delta
if current_energy > max_energy:
current_energy = max_energy



+ 11
- 1
Data/Scripts/UI/GUI.gd 查看文件

@@ -7,6 +7,9 @@ onready var _need_bar_tween = get_node("PlayerUI/MoodBars/Neediness/Bar/Progress
onready var _content_bar = get_node("PlayerUI/MoodBars/Contentment/Bar/Progress")
onready var _content_bar_tween = get_node("PlayerUI/MoodBars/Contentment/Bar/Progress/Tween")

onready var _nrg_bar = get_node("PlayerUI/NRG/Bar/Progress")
onready var _nrg_bar_tween = get_node("PlayerUI/NRG/Bar/Progress/Tween")

# Called when the node enters the scene tree for the first time.
func _ready():
set_process(true)
@@ -16,16 +19,23 @@ func _ready():
_need_bar.value = 0.0
_content_bar.max_value = 100.0
_content_bar.value = 0.0
_nrg_bar.max_value = get_node("../Player").max_energy
_nrg_bar.value = get_node("../Player").get_current_energy()


func _process(delta):
UpdateMoodBars()

func UpdateMoodBars():
var mc = get_node("../Player").get_mood().get_mood_color()
var p = get_node("../Player")
var mc = p.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()
_nrg_bar_tween.interpolate_property(_nrg_bar, "value", _nrg_bar.value, p.get_current_energy(), 0.1, Tween.TRANS_LINEAR, Tween.EASE_IN_OUT)
_nrg_bar_tween.start()

Loading…
取消
儲存