diff --git a/scenes/gui/OutlineRect.tscn b/scenes/gui/OutlineRect.tscn new file mode 100644 index 0000000..4abca03 --- /dev/null +++ b/scenes/gui/OutlineRect.tscn @@ -0,0 +1,48 @@ +[gd_scene load_steps=2 format=3 uid="uid://55cgw0lg8pab"] + +[ext_resource type="Script" path="res://src/OutlineRect.gd" id="1_2f5i4"] + +[node name="OutlineRect" type="Control"] +layout_mode = 3 +anchors_preset = 0 +offset_right = 100.0 +offset_bottom = 20.0 +script = ExtResource("1_2f5i4") + +[node name="ColorRect" type="ColorRect" parent="."] +layout_mode = 1 +anchors_preset = 10 +anchor_right = 1.0 +offset_bottom = 1.0 +grow_horizontal = 2 + +[node name="ColorRect2" type="ColorRect" parent="."] +layout_mode = 1 +anchors_preset = 9 +anchor_bottom = 1.0 +offset_top = 1.0 +offset_right = 1.0 +offset_bottom = -1.0 +grow_vertical = 2 + +[node name="ColorRect3" type="ColorRect" parent="."] +layout_mode = 1 +anchors_preset = 12 +anchor_top = 1.0 +anchor_right = 1.0 +anchor_bottom = 1.0 +offset_top = -1.0 +grow_horizontal = 2 +grow_vertical = 0 + +[node name="ColorRect4" type="ColorRect" parent="."] +layout_mode = 1 +anchors_preset = 11 +anchor_left = 1.0 +anchor_right = 1.0 +anchor_bottom = 1.0 +offset_left = -1.0 +offset_top = 1.0 +offset_bottom = -1.0 +grow_horizontal = 0 +grow_vertical = 2 diff --git a/scenes/gui/OutlineRect2.tscn b/scenes/gui/OutlineRect2.tscn new file mode 100644 index 0000000..b2dbb41 --- /dev/null +++ b/scenes/gui/OutlineRect2.tscn @@ -0,0 +1,48 @@ +[gd_scene load_steps=2 format=3 uid="uid://b87u4664q1o8u"] + +[ext_resource type="Script" path="res://src/OutlineRect.gd" id="1_s8wxs"] + +[node name="OutlineRect2" type="Control"] +layout_mode = 3 +anchors_preset = 0 +offset_right = 100.0 +offset_bottom = 20.0 +script = ExtResource("1_s8wxs") + +[node name="ColorRect" type="ColorRect" parent="."] +layout_mode = 1 +anchors_preset = 10 +anchor_right = 1.0 +offset_bottom = 2.0 +grow_horizontal = 2 + +[node name="ColorRect2" type="ColorRect" parent="."] +layout_mode = 1 +anchors_preset = 9 +anchor_bottom = 1.0 +offset_top = 2.0 +offset_right = 2.0 +offset_bottom = -2.0 +grow_vertical = 2 + +[node name="ColorRect3" type="ColorRect" parent="."] +layout_mode = 1 +anchors_preset = 12 +anchor_top = 1.0 +anchor_right = 1.0 +anchor_bottom = 1.0 +offset_top = -2.0 +grow_horizontal = 2 +grow_vertical = 0 + +[node name="ColorRect4" type="ColorRect" parent="."] +layout_mode = 1 +anchors_preset = 11 +anchor_left = 1.0 +anchor_right = 1.0 +anchor_bottom = 1.0 +offset_left = -2.0 +offset_top = 2.0 +offset_bottom = -2.0 +grow_horizontal = 0 +grow_vertical = 2 diff --git a/scenes/gui/SelectionList.tscn b/scenes/gui/SelectionList.tscn index b4b4946..1658ecf 100644 --- a/scenes/gui/SelectionList.tscn +++ b/scenes/gui/SelectionList.tscn @@ -1,9 +1,16 @@ -[gd_scene load_steps=2 format=3 uid="uid://0k0j6ct7kxtt"] +[gd_scene load_steps=3 format=3 uid="uid://0k0j6ct7kxtt"] [ext_resource type="Script" path="res://src/SelectionList.gd" id="1_bao2f"] +[ext_resource type="PackedScene" uid="uid://b87u4664q1o8u" path="res://scenes/gui/OutlineRect2.tscn" id="2_v4kkt"] [node name="SelectionList" type="Control"] custom_minimum_size = Vector2(100, 20) layout_mode = 3 anchors_preset = 0 script = ExtResource("1_bao2f") + +[node name="Selection" parent="." instance=ExtResource("2_v4kkt")] +color = Color(0, 0, 0, 1) + +[node name="Hover" parent="." instance=ExtResource("2_v4kkt")] +color = Color(0.392157, 0.392157, 0.392157, 1) diff --git a/scenes/world/Player.tscn b/scenes/world/Player.tscn index 245b5d6..f3c03b1 100644 --- a/scenes/world/Player.tscn +++ b/scenes/world/Player.tscn @@ -1,6 +1,11 @@ -[gd_scene load_steps=3 format=3 uid="uid://dm33ofcbh8sht"] +[gd_scene load_steps=8 format=3 uid="uid://dm33ofcbh8sht"] [ext_resource type="Script" path="res://src/Player.gd" id="1_n772d"] +[ext_resource type="Texture2D" uid="uid://rfpsi4xnxdu" path="res://GFX/BlinkIcon.png" id="2_kjp08"] +[ext_resource type="Texture2D" uid="uid://cxhd2cjff4n1" path="res://GFX/sprinticon.png" id="3_7frn8"] +[ext_resource type="PackedScene" uid="uid://55cgw0lg8pab" path="res://scenes/gui/OutlineRect.tscn" id="4_r7w8e"] +[ext_resource type="Texture2D" uid="uid://c5p7utpptgtww" path="res://GFX/BlinkMeter.jpg" id="5_iwhsa"] +[ext_resource type="Texture2D" uid="uid://den5phi138pyh" path="res://GFX/StaminaMeter.jpg" id="6_g44nt"] [sub_resource type="BoxShape3D" id="BoxShape3D_7hapa"] size = Vector3(1, 2, 1) @@ -24,3 +29,370 @@ hit_from_inside = true [node name="FloorPick" type="RayCast3D" parent="."] target_position = Vector3(0, -10, 0) + +[node name="HUD" type="Control" parent="."] +layout_mode = 3 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 + +[node name="BlinkIconBG" type="ColorRect" parent="HUD"] +layout_mode = 0 +offset_right = 32.0 +offset_bottom = 32.0 + +[node name="BlinkIcon" type="TextureRect" parent="HUD/BlinkIconBG"] +layout_mode = 0 +offset_left = 1.0 +offset_top = 1.0 +offset_right = 31.0 +offset_bottom = 31.0 +texture = ExtResource("2_kjp08") + +[node name="SprintIconBG" type="ColorRect" parent="HUD"] +layout_mode = 0 +offset_left = 33.0 +offset_right = 65.0 +offset_bottom = 32.0 + +[node name="SprintIcon" type="TextureRect" parent="HUD/SprintIconBG"] +layout_mode = 0 +offset_left = 1.0 +offset_top = 1.0 +offset_right = 31.0 +offset_bottom = 31.0 +texture = ExtResource("3_7frn8") + +[node name="These meters are lazy" type="Node" parent="HUD"] + +[node name="BlinkMeter" parent="HUD" instance=ExtResource("4_r7w8e")] +offset_left = 66.0 +offset_top = 21.0 +offset_right = 270.0 +offset_bottom = 41.0 + +[node name="Block1" type="TextureRect" parent="HUD/BlinkMeter"] +layout_mode = 0 +offset_left = 3.0 +offset_top = 3.0 +offset_right = 11.0 +offset_bottom = 17.0 +texture = ExtResource("5_iwhsa") + +[node name="Block2" type="TextureRect" parent="HUD/BlinkMeter"] +layout_mode = 0 +offset_left = 13.0 +offset_top = 3.0 +offset_right = 21.0 +offset_bottom = 17.0 +texture = ExtResource("5_iwhsa") + +[node name="Block3" type="TextureRect" parent="HUD/BlinkMeter"] +layout_mode = 0 +offset_left = 23.0 +offset_top = 3.0 +offset_right = 31.0 +offset_bottom = 17.0 +texture = ExtResource("5_iwhsa") + +[node name="Block4" type="TextureRect" parent="HUD/BlinkMeter"] +layout_mode = 0 +offset_left = 33.0 +offset_top = 3.0 +offset_right = 41.0 +offset_bottom = 17.0 +texture = ExtResource("5_iwhsa") + +[node name="Block5" type="TextureRect" parent="HUD/BlinkMeter"] +layout_mode = 0 +offset_left = 43.0 +offset_top = 3.0 +offset_right = 51.0 +offset_bottom = 17.0 +texture = ExtResource("5_iwhsa") + +[node name="Block6" type="TextureRect" parent="HUD/BlinkMeter"] +layout_mode = 0 +offset_left = 53.0 +offset_top = 3.0 +offset_right = 61.0 +offset_bottom = 17.0 +texture = ExtResource("5_iwhsa") + +[node name="Block7" type="TextureRect" parent="HUD/BlinkMeter"] +layout_mode = 0 +offset_left = 63.0 +offset_top = 3.0 +offset_right = 71.0 +offset_bottom = 17.0 +texture = ExtResource("5_iwhsa") + +[node name="Block8" type="TextureRect" parent="HUD/BlinkMeter"] +layout_mode = 0 +offset_left = 73.0 +offset_top = 3.0 +offset_right = 81.0 +offset_bottom = 17.0 +texture = ExtResource("5_iwhsa") + +[node name="Block9" type="TextureRect" parent="HUD/BlinkMeter"] +layout_mode = 0 +offset_left = 83.0 +offset_top = 3.0 +offset_right = 91.0 +offset_bottom = 17.0 +texture = ExtResource("5_iwhsa") + +[node name="Block10" type="TextureRect" parent="HUD/BlinkMeter"] +layout_mode = 0 +offset_left = 93.0 +offset_top = 3.0 +offset_right = 101.0 +offset_bottom = 17.0 +texture = ExtResource("5_iwhsa") + +[node name="Block11" type="TextureRect" parent="HUD/BlinkMeter"] +layout_mode = 0 +offset_left = 103.0 +offset_top = 3.0 +offset_right = 111.0 +offset_bottom = 17.0 +texture = ExtResource("5_iwhsa") + +[node name="Block12" type="TextureRect" parent="HUD/BlinkMeter"] +layout_mode = 0 +offset_left = 113.0 +offset_top = 3.0 +offset_right = 121.0 +offset_bottom = 17.0 +texture = ExtResource("5_iwhsa") + +[node name="Block13" type="TextureRect" parent="HUD/BlinkMeter"] +layout_mode = 0 +offset_left = 123.0 +offset_top = 3.0 +offset_right = 131.0 +offset_bottom = 17.0 +texture = ExtResource("5_iwhsa") + +[node name="Block14" type="TextureRect" parent="HUD/BlinkMeter"] +layout_mode = 0 +offset_left = 133.0 +offset_top = 3.0 +offset_right = 141.0 +offset_bottom = 17.0 +texture = ExtResource("5_iwhsa") + +[node name="Block15" type="TextureRect" parent="HUD/BlinkMeter"] +layout_mode = 0 +offset_left = 143.0 +offset_top = 3.0 +offset_right = 151.0 +offset_bottom = 17.0 +texture = ExtResource("5_iwhsa") + +[node name="Block16" type="TextureRect" parent="HUD/BlinkMeter"] +layout_mode = 0 +offset_left = 153.0 +offset_top = 3.0 +offset_right = 161.0 +offset_bottom = 17.0 +texture = ExtResource("5_iwhsa") + +[node name="Block17" type="TextureRect" parent="HUD/BlinkMeter"] +layout_mode = 0 +offset_left = 163.0 +offset_top = 3.0 +offset_right = 171.0 +offset_bottom = 17.0 +texture = ExtResource("5_iwhsa") + +[node name="Block18" type="TextureRect" parent="HUD/BlinkMeter"] +layout_mode = 0 +offset_left = 173.0 +offset_top = 3.0 +offset_right = 181.0 +offset_bottom = 17.0 +texture = ExtResource("5_iwhsa") + +[node name="Block19" type="TextureRect" parent="HUD/BlinkMeter"] +layout_mode = 0 +offset_left = 183.0 +offset_top = 3.0 +offset_right = 191.0 +offset_bottom = 17.0 +texture = ExtResource("5_iwhsa") + +[node name="Block20" type="TextureRect" parent="HUD/BlinkMeter"] +layout_mode = 0 +offset_left = 193.0 +offset_top = 3.0 +offset_right = 201.0 +offset_bottom = 17.0 +texture = ExtResource("5_iwhsa") + +[node name="SprintMeter" parent="HUD" instance=ExtResource("4_r7w8e")] +offset_left = 66.0 +offset_right = 270.0 + +[node name="Block1" type="TextureRect" parent="HUD/SprintMeter"] +layout_mode = 0 +offset_left = 3.0 +offset_top = 3.0 +offset_right = 11.0 +offset_bottom = 17.0 +texture = ExtResource("6_g44nt") + +[node name="Block2" type="TextureRect" parent="HUD/SprintMeter"] +layout_mode = 0 +offset_left = 13.0 +offset_top = 3.0 +offset_right = 21.0 +offset_bottom = 17.0 +texture = ExtResource("6_g44nt") + +[node name="Block3" type="TextureRect" parent="HUD/SprintMeter"] +layout_mode = 0 +offset_left = 23.0 +offset_top = 3.0 +offset_right = 31.0 +offset_bottom = 17.0 +texture = ExtResource("6_g44nt") + +[node name="Block4" type="TextureRect" parent="HUD/SprintMeter"] +layout_mode = 0 +offset_left = 33.0 +offset_top = 3.0 +offset_right = 41.0 +offset_bottom = 17.0 +texture = ExtResource("6_g44nt") + +[node name="Block5" type="TextureRect" parent="HUD/SprintMeter"] +layout_mode = 0 +offset_left = 43.0 +offset_top = 3.0 +offset_right = 51.0 +offset_bottom = 17.0 +texture = ExtResource("6_g44nt") + +[node name="Block6" type="TextureRect" parent="HUD/SprintMeter"] +layout_mode = 0 +offset_left = 53.0 +offset_top = 3.0 +offset_right = 61.0 +offset_bottom = 17.0 +texture = ExtResource("6_g44nt") + +[node name="Block7" type="TextureRect" parent="HUD/SprintMeter"] +layout_mode = 0 +offset_left = 63.0 +offset_top = 3.0 +offset_right = 71.0 +offset_bottom = 17.0 +texture = ExtResource("6_g44nt") + +[node name="Block8" type="TextureRect" parent="HUD/SprintMeter"] +layout_mode = 0 +offset_left = 73.0 +offset_top = 3.0 +offset_right = 81.0 +offset_bottom = 17.0 +texture = ExtResource("6_g44nt") + +[node name="Block9" type="TextureRect" parent="HUD/SprintMeter"] +layout_mode = 0 +offset_left = 83.0 +offset_top = 3.0 +offset_right = 91.0 +offset_bottom = 17.0 +texture = ExtResource("6_g44nt") + +[node name="Block10" type="TextureRect" parent="HUD/SprintMeter"] +layout_mode = 0 +offset_left = 93.0 +offset_top = 3.0 +offset_right = 101.0 +offset_bottom = 17.0 +texture = ExtResource("6_g44nt") + +[node name="Block11" type="TextureRect" parent="HUD/SprintMeter"] +layout_mode = 0 +offset_left = 103.0 +offset_top = 3.0 +offset_right = 111.0 +offset_bottom = 17.0 +texture = ExtResource("6_g44nt") + +[node name="Block12" type="TextureRect" parent="HUD/SprintMeter"] +layout_mode = 0 +offset_left = 113.0 +offset_top = 3.0 +offset_right = 121.0 +offset_bottom = 17.0 +texture = ExtResource("6_g44nt") + +[node name="Block13" type="TextureRect" parent="HUD/SprintMeter"] +layout_mode = 0 +offset_left = 123.0 +offset_top = 3.0 +offset_right = 131.0 +offset_bottom = 17.0 +texture = ExtResource("6_g44nt") + +[node name="Block14" type="TextureRect" parent="HUD/SprintMeter"] +layout_mode = 0 +offset_left = 133.0 +offset_top = 3.0 +offset_right = 141.0 +offset_bottom = 17.0 +texture = ExtResource("6_g44nt") + +[node name="Block15" type="TextureRect" parent="HUD/SprintMeter"] +layout_mode = 0 +offset_left = 143.0 +offset_top = 3.0 +offset_right = 151.0 +offset_bottom = 17.0 +texture = ExtResource("6_g44nt") + +[node name="Block16" type="TextureRect" parent="HUD/SprintMeter"] +layout_mode = 0 +offset_left = 153.0 +offset_top = 3.0 +offset_right = 161.0 +offset_bottom = 17.0 +texture = ExtResource("6_g44nt") + +[node name="Block17" type="TextureRect" parent="HUD/SprintMeter"] +layout_mode = 0 +offset_left = 163.0 +offset_top = 3.0 +offset_right = 171.0 +offset_bottom = 17.0 +texture = ExtResource("6_g44nt") + +[node name="Block18" type="TextureRect" parent="HUD/SprintMeter"] +layout_mode = 0 +offset_left = 173.0 +offset_top = 3.0 +offset_right = 181.0 +offset_bottom = 17.0 +texture = ExtResource("6_g44nt") + +[node name="Block19" type="TextureRect" parent="HUD/SprintMeter"] +layout_mode = 0 +offset_left = 183.0 +offset_top = 3.0 +offset_right = 191.0 +offset_bottom = 17.0 +texture = ExtResource("6_g44nt") + +[node name="Block20" type="TextureRect" parent="HUD/SprintMeter"] +layout_mode = 0 +offset_left = 193.0 +offset_top = 3.0 +offset_right = 201.0 +offset_bottom = 17.0 +texture = ExtResource("6_g44nt") diff --git a/shaders/RepeatTex.gdshader b/shaders/RepeatTex.gdshader new file mode 100644 index 0000000..187fa40 --- /dev/null +++ b/shaders/RepeatTex.gdshader @@ -0,0 +1,18 @@ +shader_type canvas_item; + +uniform sampler2D loop_texture; + +void vertex() { + // Called for every vertex the material is visible on. +} + +void fragment() { + vec4 silly = texture(loop_texture, SCREEN_UV); + + COLOR = silly; +} + +//void light() { + // Called for every pixel for every light affecting the CanvasItem. + // Uncomment to replace the default light processing function with this one. +//} diff --git a/src/Global.gd b/src/Global.gd index c7d4db5..e9e044a 100644 --- a/src/Global.gd +++ b/src/Global.gd @@ -41,11 +41,19 @@ func LoadAudio(rawFileName: String): var fixedName = rawFileName.replace("\\", "/") return audioCache.get_or_add(fixedName, load(str("res://", fixedName))) +#var resolution: Vector2i +# +#func resize(): + #resolution = DisplayServer.window_get_size() + func _ready(): clickSound = AudioStreamPlayer.new() clickSound.stream = LoadAudio("SFX/Interact/Button.ogg") clickSound.max_polyphony = 5 add_child(clickSound) + + #resolution = DisplayServer.window_get_size() + #get_viewport().connect("size_changed", resize) Input.set_custom_mouse_cursor(Utils.KeyBackground(LoadTexture("GFX/cursor.PNG"), Color(0, 0, 0, 1))) @@ -53,3 +61,4 @@ func _ready(): func _process(delta): FPSfactor = delta * 1000 + #FPSfactor = max(min(delta * 70, 5.0), 0.2) diff --git a/src/OutlineRect.gd b/src/OutlineRect.gd new file mode 100644 index 0000000..7f3373d --- /dev/null +++ b/src/OutlineRect.gd @@ -0,0 +1,10 @@ +extends Control +class_name OutlineRect + +@export var color = Color(1, 1, 1) + +func _ready() -> void: + $ColorRect.color = color + $ColorRect2.color = color + $ColorRect3.color = color + $ColorRect4.color = color diff --git a/src/Player.gd b/src/Player.gd index d606ede..895f923 100644 --- a/src/Player.gd +++ b/src/Player.gd @@ -4,12 +4,32 @@ var head: Node3D var camera: Camera3D var floorRay: RayCast3D var floorPick: RayCast3D +var blinkIconBG: ColorRect +var sprintIconBG: ColorRect +var blinkBar: Control +var sprintBar: Control +var Hud: Control func _ready() -> void: head = $Head camera = $Head/Camera floorRay = $FloorRay floorPick = $FloorPick + blinkIconBG = $HUD/BlinkIconBG + sprintIconBG = $HUD/SprintIconBG + blinkBar = $HUD/BlinkMeter + sprintBar = $HUD/SprintMeter + Hud = $HUD + + #Select SelectedDifficulty\otherFactors + #Case EASY + BLINKFREQ = randi_range(490, 700) + #Case NORMAL + #BLINKFREQ = Rnd(455,665) + #Case HARD + #BLINKFREQ = Rnd(420,630) + #End Select + BlinkTimer = BLINKFREQ var CurrSpeed: float var CrouchState: float @@ -34,10 +54,37 @@ var ForceAngle: float var DropSpeed: float var ShouldEntitiesFall: bool = true +var BlinkTimer = 0 +var BLINKFREQ = 0 + var Injuries: float var Rotation: Vector3 = Vector3() +func _process(delta: float) -> void: + var width = 204 + var height = 20 + var x = 80 + var y = Hud.size.y - 95 + + blinkIconBG.position.x = x - 51 + blinkIconBG.position.y = y - 1 + blinkBar.position.x = x + blinkBar.position.y = y + + y = Hud.size.y - 55 + sprintIconBG.position.x = x - 51 + sprintIconBG.position.y = y - 1 + sprintBar.position.x = x + sprintBar.position.y = y + + var barAmount = int(((width - 2) * (BlinkTimer / (BLINKFREQ))) / 10) + for i in int(((width - 2) * (BlinkTimer / (BLINKFREQ))) / 10): + blinkBar.get_child(i).visible = true + + for i in range(barAmount, 20): + blinkBar.get_child(i).visible = false + func _physics_process(delta: float) -> void: var Sprint = 1.0 var Speed = 0.018 diff --git a/src/SelectionList.gd b/src/SelectionList.gd index df23ffc..005a89f 100644 --- a/src/SelectionList.gd +++ b/src/SelectionList.gd @@ -3,11 +3,18 @@ extends Control @export var selectionList: Array var options: Array +var selection: OutlineRect +var hover: OutlineRect # Called when the node enters the scene tree for the first time. func _ready() -> void: var font = load("res://GFX/font/cour/Courier New.ttf") + selection = $Selection + hover = $Hover + + hover.visible = false + for column in range(ceil(selectionList.size() / 6.0)): var why = 0 for i in range(6 * column, (6 * column) + 6): @@ -18,6 +25,7 @@ func _ready() -> void: option.position.x = 13 + (100 * column) option.position.y = 10 + (20 * why) option.size = Vector2(100, 20) + option.mouse_filter = Control.MOUSE_FILTER_IGNORE var label = Label.new() label.text = selectionList[i] label.add_theme_font_override("font", font) @@ -26,8 +34,3 @@ func _ready() -> void: option.add_child(label) add_child(option) why += 1 - - -# Called every frame. 'delta' is the elapsed time since the previous frame. -func _process(delta: float) -> void: - pass