more tweaks to UI
This commit is contained in:
BIN
assets/UI/Edit Files/0.5x/Stamina_White@0.5x.png
Normal file
BIN
assets/UI/Edit Files/0.5x/Stamina_White@0.5x.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 792 B |
34
assets/UI/Edit Files/0.5x/Stamina_White@0.5x.png.import
Normal file
34
assets/UI/Edit Files/0.5x/Stamina_White@0.5x.png.import
Normal file
@@ -0,0 +1,34 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://b8r7mp1r4xqv1"
|
||||
path="res://.godot/imported/Stamina_White@0.5x.png-d7430949249248bcd63fabe7d05a52bd.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/UI/Edit Files/0.5x/Stamina_White@0.5x.png"
|
||||
dest_files=["res://.godot/imported/Stamina_White@0.5x.png-d7430949249248bcd63fabe7d05a52bd.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
BIN
assets/UI/Edit Files/0.5x/Stamina_v2@0.5x.png
Normal file
BIN
assets/UI/Edit Files/0.5x/Stamina_v2@0.5x.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 948 B |
34
assets/UI/Edit Files/0.5x/Stamina_v2@0.5x.png.import
Normal file
34
assets/UI/Edit Files/0.5x/Stamina_v2@0.5x.png.import
Normal file
@@ -0,0 +1,34 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://b6ttywi1f5bg8"
|
||||
path="res://.godot/imported/Stamina_v2@0.5x.png-0f5b4246ae5bae1dd1f5a9a45795263a.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/UI/Edit Files/0.5x/Stamina_v2@0.5x.png"
|
||||
dest_files=["res://.godot/imported/Stamina_v2@0.5x.png-0f5b4246ae5bae1dd1f5a9a45795263a.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
BIN
assets/UI/Edit Files/0.5x/Stamina_v3@0.5x.png
Normal file
BIN
assets/UI/Edit Files/0.5x/Stamina_v3@0.5x.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.9 KiB |
34
assets/UI/Edit Files/0.5x/Stamina_v3@0.5x.png.import
Normal file
34
assets/UI/Edit Files/0.5x/Stamina_v3@0.5x.png.import
Normal file
@@ -0,0 +1,34 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://bsbpbaqgrqa4o"
|
||||
path="res://.godot/imported/Stamina_v3@0.5x.png-b8d1097206fd1ae27c337268321e11c0.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/UI/Edit Files/0.5x/Stamina_v3@0.5x.png"
|
||||
dest_files=["res://.godot/imported/Stamina_v3@0.5x.png-b8d1097206fd1ae27c337268321e11c0.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
BIN
assets/UI/Edit Files/0.5x/Staminabacking_v2@0.5x.png
Normal file
BIN
assets/UI/Edit Files/0.5x/Staminabacking_v2@0.5x.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 892 B |
34
assets/UI/Edit Files/0.5x/Staminabacking_v2@0.5x.png.import
Normal file
34
assets/UI/Edit Files/0.5x/Staminabacking_v2@0.5x.png.import
Normal file
@@ -0,0 +1,34 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://cujbtwkiwx6ji"
|
||||
path="res://.godot/imported/Staminabacking_v2@0.5x.png-3b11e5656058091122a805aa12b8667e.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/UI/Edit Files/0.5x/Staminabacking_v2@0.5x.png"
|
||||
dest_files=["res://.godot/imported/Staminabacking_v2@0.5x.png-3b11e5656058091122a805aa12b8667e.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
File diff suppressed because one or more lines are too long
68
hud.tscn
68
hud.tscn
@@ -2,7 +2,7 @@
|
||||
|
||||
[ext_resource type="Script" path="res://scripts/hud.gd" id="1_7hukm"]
|
||||
[ext_resource type="Theme" uid="uid://clek42ofxr45f" path="res://DefaultTheme.tres" id="1_22trs"]
|
||||
[ext_resource type="Texture2D" uid="uid://bwl5sqoq7acfv" path="res://assets/UI/0.5x/Stamina_v2@0.5x.png" id="2_jj8dm"]
|
||||
[ext_resource type="Texture2D" uid="uid://b8r7mp1r4xqv1" path="res://assets/UI/Edit Files/0.5x/Stamina_White@0.5x.png" id="3_2injg"]
|
||||
[ext_resource type="Texture2D" uid="uid://mcay8s80071h" path="res://assets/UI/Crosshair/SVG/Reticle 1_svg.svg" id="3_tmj0x"]
|
||||
[ext_resource type="Script" path="res://scripts/UIScreenAdjust.gd" id="4_lbnof"]
|
||||
|
||||
@@ -14,10 +14,9 @@ expand_margin_right = 2.0
|
||||
expand_margin_bottom = 2.0
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_axtce"]
|
||||
bg_color = Color(0.898526, 0, 0.204086, 1)
|
||||
bg_color = Color(1, 1, 1, 0.498039)
|
||||
|
||||
[sub_resource type="CanvasItemMaterial" id="CanvasItemMaterial_ytfhs"]
|
||||
blend_mode = 1
|
||||
|
||||
[node name="HUD" type="Control"]
|
||||
layout_mode = 3
|
||||
@@ -27,22 +26,34 @@ anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
script = ExtResource("1_7hukm")
|
||||
radial_stamina = true
|
||||
|
||||
[node name="LeftMargin" type="MarginContainer" parent="."]
|
||||
layout_mode = 1
|
||||
anchors_preset = 2
|
||||
anchor_top = 1.0
|
||||
anchor_bottom = 1.0
|
||||
offset_top = -40.0
|
||||
offset_right = 200.0
|
||||
offset_top = -125.0
|
||||
offset_right = 300.0
|
||||
grow_vertical = 0
|
||||
theme_override_constants/margin_left = 50
|
||||
theme_override_constants/margin_top = 50
|
||||
theme_override_constants/margin_right = 50
|
||||
theme_override_constants/margin_bottom = 50
|
||||
|
||||
[node name="HealthBar" type="ProgressBar" parent="LeftMargin"]
|
||||
custom_minimum_size = Vector2(200, 25)
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="LeftMargin"]
|
||||
layout_mode = 2
|
||||
theme_override_constants/separation = 10
|
||||
|
||||
[node name="Money" type="Label" parent="LeftMargin/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
theme = ExtResource("1_22trs")
|
||||
theme_type_variation = &"TextShadow"
|
||||
theme_override_colors/font_shadow_color = Color(0, 0, 0, 1)
|
||||
text = "$"
|
||||
|
||||
[node name="HealthBar" type="ProgressBar" parent="LeftMargin/VBoxContainer"]
|
||||
custom_minimum_size = Vector2(300, 50)
|
||||
layout_mode = 2
|
||||
theme = ExtResource("1_22trs")
|
||||
theme_override_styles/background = SubResource("StyleBoxFlat_2hn4h")
|
||||
@@ -58,15 +69,36 @@ anchor_left = 0.5
|
||||
anchor_top = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 0.5
|
||||
offset_left = -24.5
|
||||
offset_top = -24.5
|
||||
offset_right = 24.5
|
||||
offset_bottom = 24.5
|
||||
offset_left = -23.5
|
||||
offset_top = -23.5
|
||||
offset_right = 23.5
|
||||
offset_bottom = 23.5
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
value = 100.0
|
||||
value = 49.0
|
||||
fill_mode = 5
|
||||
texture_progress = ExtResource("2_jj8dm")
|
||||
texture_progress = ExtResource("3_2injg")
|
||||
|
||||
[node name="StaminaBar2" type="ProgressBar" parent="."]
|
||||
custom_minimum_size = Vector2(30, 10)
|
||||
layout_mode = 1
|
||||
anchors_preset = 8
|
||||
anchor_left = 0.5
|
||||
anchor_top = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 0.5
|
||||
offset_left = 50.0
|
||||
offset_top = 27.0
|
||||
offset_right = 105.0
|
||||
offset_bottom = 37.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
rotation = -1.5708
|
||||
theme = ExtResource("1_22trs")
|
||||
theme_override_styles/background = SubResource("StyleBoxFlat_2hn4h")
|
||||
theme_override_styles/fill = SubResource("StyleBoxFlat_axtce")
|
||||
value = 35.29
|
||||
show_percentage = false
|
||||
|
||||
[node name="Crosshair" type="TextureRect" parent="." groups=["hud"]]
|
||||
layout_mode = 1
|
||||
@@ -91,8 +123,8 @@ anchor_left = 1.0
|
||||
anchor_top = 1.0
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
offset_left = -40.0
|
||||
offset_top = -40.0
|
||||
offset_left = -584.0
|
||||
offset_top = -314.0
|
||||
grow_horizontal = 0
|
||||
grow_vertical = 0
|
||||
theme = ExtResource("1_22trs")
|
||||
@@ -103,16 +135,22 @@ theme_override_constants/margin_bottom = 50
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 8
|
||||
size_flags_vertical = 8
|
||||
theme = ExtResource("1_22trs")
|
||||
theme_override_constants/separation = 10
|
||||
|
||||
[node name="Gun Name" type="Label" parent="MarginContainer/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
theme = ExtResource("1_22trs")
|
||||
theme_type_variation = &"TextShadow"
|
||||
theme_override_colors/font_shadow_color = Color(0, 0, 0, 1)
|
||||
text = "Gun Name"
|
||||
horizontal_alignment = 2
|
||||
|
||||
[node name="Ammo" type="Label" parent="MarginContainer/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
theme = ExtResource("1_22trs")
|
||||
theme_override_colors/font_shadow_color = Color(0, 0, 0, 1)
|
||||
text = "XX - XX"
|
||||
horizontal_alignment = 1
|
||||
|
||||
@@ -1,27 +1,50 @@
|
||||
extends Control
|
||||
|
||||
@export var radial_stamina : bool = false
|
||||
|
||||
var current_stam_bar
|
||||
var stam_bar_visible : bool = false
|
||||
var interact_visible : bool = false
|
||||
|
||||
@onready var level_control = get_tree().current_scene
|
||||
@onready var player = level_control.player
|
||||
@onready var stamina_bar: TextureProgressBar = $StaminaBar
|
||||
@onready var health_bar: ProgressBar = $LeftMargin/HealthBar
|
||||
@onready var stamina_bar_2: ProgressBar = $StaminaBar2
|
||||
@onready var health_bar: ProgressBar = $LeftMargin/VBoxContainer/HealthBar
|
||||
@onready var gun_name: Label = $"MarginContainer/VBoxContainer/Gun Name"
|
||||
@onready var ammo: Label = $MarginContainer/VBoxContainer/Ammo
|
||||
@onready var money: Label = $LeftMargin/VBoxContainer/Money
|
||||
@onready var crosshair: TextureRect = $Crosshair
|
||||
|
||||
const FULL_WHITE = Color(1, 1, 1, 1)
|
||||
const TRANSPARENT = Color(1, 1, 1, 0)
|
||||
const RED_COLOR = Color(1, 0, 0)
|
||||
const GREEN_COLOR = Color(0, 0.608, 0.172)
|
||||
|
||||
const STAM_BAR_MAX_OPACITY = .7
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
health_bar.max_value = level_control.start_health
|
||||
|
||||
if radial_stamina:
|
||||
current_stam_bar = stamina_bar
|
||||
stamina_bar_2.visible = false
|
||||
else:
|
||||
current_stam_bar = stamina_bar_2
|
||||
stamina_bar.visible = false
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta: float) -> void:
|
||||
player = level_control.player
|
||||
if player != null:
|
||||
health_bar.value = level_control.health
|
||||
money.text = "$" + str(level_control.money)
|
||||
if player.remaining_stamina/player.MAX_STAMINA >= .99:
|
||||
stamina_bar.visible = false
|
||||
stam_bar_visible = false
|
||||
else:
|
||||
stamina_bar.visible = true
|
||||
stamina_bar.value = player.remaining_stamina
|
||||
stam_bar_visible = true
|
||||
current_stam_bar.value = player.remaining_stamina
|
||||
|
||||
ammo.text = str(level_control.ammo_current[level_control.current_gun_index]) +" - " + str(level_control.ammo_reserve[level_control.current_gun_index])
|
||||
|
||||
@@ -29,3 +52,36 @@ func _process(delta: float) -> void:
|
||||
gun_name.text = player.gun.gun_name
|
||||
else:
|
||||
gun_name.visible = false
|
||||
|
||||
if player.remaining_stamina < 25:
|
||||
change_color(current_stam_bar,RED_COLOR,10,delta)
|
||||
change_color(crosshair,RED_COLOR,10,delta)
|
||||
else:
|
||||
change_color(current_stam_bar,FULL_WHITE,10,delta)
|
||||
change_color(crosshair,FULL_WHITE,10,delta)
|
||||
|
||||
if player.interact_ray.is_colliding():
|
||||
if player.interact_ray.get_collider().is_in_group("interact"):
|
||||
interact_visible = true
|
||||
else:
|
||||
interact_visible = false
|
||||
else:
|
||||
interact_visible = false
|
||||
|
||||
if interact_visible == true:
|
||||
change_color(crosshair,GREEN_COLOR,10,delta)
|
||||
else:
|
||||
change_color(crosshair,FULL_WHITE,10,delta)
|
||||
|
||||
## FADE ELEMENTS IN AND OUT
|
||||
fade_in_out(current_stam_bar,STAM_BAR_MAX_OPACITY,stam_bar_visible,delta)
|
||||
|
||||
func change_color(element,color,speed,delta):
|
||||
element.modulate = lerp(element.modulate, Color(color.r,color.g,color.b,element.modulate.a), (delta * speed)/Engine.time_scale)
|
||||
|
||||
func fade_in_out(element,MAX_OPACITY,visible,delta):
|
||||
var element_color = element.modulate
|
||||
if visible:
|
||||
element.modulate = lerp(element_color, Color(element_color.r,element_color.g,element_color.b,MAX_OPACITY),(delta * 10)/Engine.time_scale)
|
||||
else:
|
||||
element.modulate = lerp(element_color, Color(element_color.r,element_color.g,element_color.b,0),(delta * 10)/Engine.time_scale)
|
||||
|
||||
@@ -16,7 +16,7 @@ const SLOWSPEED = .1
|
||||
const MAX_STAMINA : float = 100
|
||||
const STAMINA_DRAIN = 20
|
||||
const BOB_FREQ = 1.7
|
||||
const BOB_AMP = 0.08
|
||||
const BOB_AMP = 0.1
|
||||
const ADS_POS = Vector3(0,-.05,-.45)
|
||||
var speed
|
||||
var double_jump = true
|
||||
|
||||
Reference in New Issue
Block a user