diff --git a/Bladder.gd b/Bladder.gd new file mode 100644 index 0000000..07e0adb --- /dev/null +++ b/Bladder.gd @@ -0,0 +1,13 @@ +extends Sprite2D + +var fill; + +# Called when the node enters the scene tree for the first time. +func _ready(): + pass # Replace with function body. + + +# Called every frame. 'delta' is the elapsed time since the previous frame. +func _process(delta): + material.set("fill",clamp(fill, 0.0, 1.0)) + diff --git a/Images/Bladder.png b/Images/Bladder.png new file mode 100644 index 0000000..36ea8b2 Binary files /dev/null and b/Images/Bladder.png differ diff --git a/Images/Bladder.png.import b/Images/Bladder.png.import new file mode 100644 index 0000000..4c54d30 --- /dev/null +++ b/Images/Bladder.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://b25de1d0yyuji" +path="res://.godot/imported/Bladder.png-67828a0d166717b5269a348903393516.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://Images/Bladder.png" +dest_files=["res://.godot/imported/Bladder.png-67828a0d166717b5269a348903393516.ctex"] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/bptc_ldr=0 +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 diff --git a/Images/BladderHollow.png b/Images/BladderHollow.png new file mode 100644 index 0000000..d95a175 Binary files /dev/null and b/Images/BladderHollow.png differ diff --git a/Images/BladderHollow.png.import b/Images/BladderHollow.png.import new file mode 100644 index 0000000..140bd62 --- /dev/null +++ b/Images/BladderHollow.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://d2nqjxofehkum" +path="res://.godot/imported/BladderHollow.png-e4fd50cc80f9ae5a6291ebfabb73f55a.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://Images/BladderHollow.png" +dest_files=["res://.godot/imported/BladderHollow.png-e4fd50cc80f9ae5a6291ebfabb73f55a.ctex"] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/bptc_ldr=0 +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 diff --git a/bladder.gdshader b/bladder.gdshader new file mode 100644 index 0000000..11691d9 --- /dev/null +++ b/bladder.gdshader @@ -0,0 +1,13 @@ +shader_type canvas_item; + +uniform vec4 tex; +uniform float fill; + +void fragment() { + + if ((fill + 0.5) * 0.5 >= 1.0 - UV.y) + COLOR = vec4(0.1, 0.4, 0.4, 1.0); + + COLOR.a = tex.a; +} + diff --git a/hud.gd b/hud.gd new file mode 100644 index 0000000..69a7084 --- /dev/null +++ b/hud.gd @@ -0,0 +1,11 @@ +extends Control + + +# Called when the node enters the scene tree for the first time. +func _ready(): + pass # Replace with function body. + + +# Called every frame. 'delta' is the elapsed time since the previous frame. +func _process(delta): + $Bladder.fill = 0.3; # <-- value goes here! diff --git a/hud.gdshader b/hud.gdshader new file mode 100644 index 0000000..f8d81eb --- /dev/null +++ b/hud.gdshader @@ -0,0 +1,9 @@ +shader_type canvas_item; + +uniform float fill; + +void fragment() { + if ((fill + 0.5) * 0.5 >= 1.0 - UV.y) + COLOR = vec4(0.1, 0.4, 0.4, texture(TEXTURE, UV).a); + else COLOR = texture(TEXTURE, UV); +} diff --git a/hud.tscn b/hud.tscn new file mode 100644 index 0000000..1520406 --- /dev/null +++ b/hud.tscn @@ -0,0 +1,33 @@ +[gd_scene load_steps=7 format=3 uid="uid://3n1o2mbywp8w"] + +[ext_resource type="Shader" path="res://hud.gdshader" id="1_0s6h4"] +[ext_resource type="Script" path="res://hud.gd" id="1_jkk58"] +[ext_resource type="Texture2D" uid="uid://b25de1d0yyuji" path="res://Images/Bladder.png" id="2_fa8jy"] +[ext_resource type="Script" path="res://Bladder.gd" id="3_tb31y"] +[ext_resource type="Texture2D" uid="uid://d2nqjxofehkum" path="res://Images/BladderHollow.png" id="4_lbxgy"] + +[sub_resource type="ShaderMaterial" id="ShaderMaterial_0gcor"] +shader = ExtResource("1_0s6h4") +shader_parameter/fill = 0.0 + +[node name="HUD" type="Control"] +layout_mode = 3 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +offset_left = 198.0 +offset_top = 205.0 +offset_right = 198.0 +offset_bottom = 205.0 +script = ExtResource("1_jkk58") + +[node name="Bladder" type="Sprite2D" parent="."] +material = SubResource("ShaderMaterial_0gcor") +scale = Vector2(4, 4) +texture = ExtResource("2_fa8jy") +script = ExtResource("3_tb31y") + +[node name="BladderHollow" type="Sprite2D" parent="."] +position = Vector2(-2, 0) +scale = Vector2(4, 4) +texture = ExtResource("4_lbxgy")