more movement tweaks & energy interface upgrade
This commit is contained in:
parent
8ab8973894
commit
bed5e49547
17 changed files with 96 additions and 161 deletions
File diff suppressed because one or more lines are too long
BIN
src/level/tiles.aseprite
(Stored with Git LFS)
BIN
src/level/tiles.aseprite
(Stored with Git LFS)
Binary file not shown.
BIN
src/level/tiles.png
(Stored with Git LFS)
BIN
src/level/tiles.png
(Stored with Git LFS)
Binary file not shown.
|
|
@ -7,7 +7,7 @@ uniform vec3 diffuse_color : source_color = vec3(0.0);
|
||||||
/** The color that doesn't get absorbed and pierces deeper. */
|
/** The color that doesn't get absorbed and pierces deeper. */
|
||||||
uniform vec3 transmission_color : source_color = vec3(0.326, 0.875, 0.943);
|
uniform vec3 transmission_color : source_color = vec3(0.326, 0.875, 0.943);
|
||||||
uniform vec4 highlights : source_color = vec4(vec3(1.0), 0.4);
|
uniform vec4 highlights : source_color = vec4(vec3(1.0), 0.4);
|
||||||
uniform float light_attenuation = -5.0;
|
uniform float light_attenuation = -6.0;
|
||||||
uniform float top_border;
|
uniform float top_border;
|
||||||
uniform float top_ribbon_depth = 1.0;
|
uniform float top_ribbon_depth = 1.0;
|
||||||
uniform vec3 top_ribbon_color : source_color = vec3(0.4);
|
uniform vec3 top_ribbon_color : source_color = vec3(0.4);
|
||||||
|
|
|
||||||
|
|
@ -59,6 +59,7 @@ public sealed partial class Player : CharacterBody2D, IAttackable, IHitboxOwner,
|
||||||
[Export] public float Health { get; set; }
|
[Export] public float Health { get; set; }
|
||||||
[Export] public bool CanTurn { get; set; } = true;
|
[Export] public bool CanTurn { get; set; } = true;
|
||||||
[Export] public float MaxDashPoints { get; set; } = 2f;
|
[Export] public float MaxDashPoints { get; set; } = 2f;
|
||||||
|
[Export] public float DashPointRate { get; set; } = 0.5f;
|
||||||
|
|
||||||
private ulong MaxInputBufferTimeMicroseconds => (ulong)(MaxInputBufferTime * 1_000_000);
|
private ulong MaxInputBufferTimeMicroseconds => (ulong)(MaxInputBufferTime * 1_000_000);
|
||||||
public bool IsJumping => !JumpTimer.IsStopped();
|
public bool IsJumping => !JumpTimer.IsStopped();
|
||||||
|
|
@ -68,6 +69,7 @@ public sealed partial class Player : CharacterBody2D, IAttackable, IHitboxOwner,
|
||||||
/// The direction the player is currently holding.
|
/// The direction the player is currently holding.
|
||||||
/// This vector's components should always be -1/0/1.
|
/// This vector's components should always be -1/0/1.
|
||||||
private Vector2 _currentDirection = Vector2.Zero;
|
private Vector2 _currentDirection = Vector2.Zero;
|
||||||
|
|
||||||
/// The raw direction the player is currently holding, no guarantees.
|
/// The raw direction the player is currently holding, no guarantees.
|
||||||
private Vector2 _currentRawDirection = Vector2.Zero;
|
private Vector2 _currentRawDirection = Vector2.Zero;
|
||||||
|
|
||||||
|
|
@ -151,6 +153,11 @@ public sealed partial class Player : CharacterBody2D, IAttackable, IHitboxOwner,
|
||||||
var dragAmount = 0f;
|
var dragAmount = 0f;
|
||||||
|
|
||||||
if (CanTurn) AdjustFacing();
|
if (CanTurn) AdjustFacing();
|
||||||
|
// This one can be buffered indefinitely.
|
||||||
|
if (!WaterJumpAllowedTimer.IsStopped() && Input.IsActionPressed(ActionName.Jump))
|
||||||
|
{
|
||||||
|
WaterExitJump();
|
||||||
|
}
|
||||||
|
|
||||||
if (!DashTimer.IsStopped())
|
if (!DashTimer.IsStopped())
|
||||||
{
|
{
|
||||||
|
|
@ -160,7 +167,13 @@ public sealed partial class Player : CharacterBody2D, IAttackable, IHitboxOwner,
|
||||||
else if (IsInWater)
|
else if (IsInWater)
|
||||||
{
|
{
|
||||||
var velocityWasTooLarge = velocity.Length() > WaterMaxSpeed;
|
var velocityWasTooLarge = velocity.Length() > WaterMaxSpeed;
|
||||||
velocity += _currentDirection.Normalized() * WaterAccel * deltaF;
|
var inputDirection = _currentDirection;
|
||||||
|
if (Input.IsActionPressed(ActionName.Jump))
|
||||||
|
{
|
||||||
|
inputDirection.Y = -1f;
|
||||||
|
}
|
||||||
|
|
||||||
|
velocity += inputDirection.Normalized() * WaterAccel * deltaF;
|
||||||
var velocityIsTooLarge = velocity.Length() > WaterMaxSpeed;
|
var velocityIsTooLarge = velocity.Length() > WaterMaxSpeed;
|
||||||
if (velocityWasTooLarge && velocityIsTooLarge)
|
if (velocityWasTooLarge && velocityIsTooLarge)
|
||||||
{
|
{
|
||||||
|
|
@ -172,10 +185,10 @@ public sealed partial class Player : CharacterBody2D, IAttackable, IHitboxOwner,
|
||||||
velocity = velocity.LimitLength(WaterMaxSpeed);
|
velocity = velocity.LimitLength(WaterMaxSpeed);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!velocityIsTooLarge && _currentDirection.IsZeroApprox())
|
if (!velocityIsTooLarge && inputDirection.IsZeroApprox())
|
||||||
{
|
{
|
||||||
dragAmount = 0.1f;
|
dragAmount = 0.1f;
|
||||||
velocity = velocity.MoveToward(Vector2.Zero, 0.1f * deltaF);
|
velocity = velocity.MoveToward(Vector2.Zero, 5f * deltaF);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Walking on the floor
|
// Walking on the floor
|
||||||
|
|
@ -204,11 +217,13 @@ public sealed partial class Player : CharacterBody2D, IAttackable, IHitboxOwner,
|
||||||
{
|
{
|
||||||
velocity.X += Mathf.Sign(_currentDirection.X) * AirAccel * deltaF;
|
velocity.X += Mathf.Sign(_currentDirection.X) * AirAccel * deltaF;
|
||||||
}
|
}
|
||||||
|
|
||||||
var velocityIsTooLarge = Mathf.Abs(velocity.X) > AirMaxSpeed;
|
var velocityIsTooLarge = Mathf.Abs(velocity.X) > AirMaxSpeed;
|
||||||
if (!velocityWasTooLarge && velocityIsTooLarge)
|
if (!velocityWasTooLarge && velocityIsTooLarge)
|
||||||
{
|
{
|
||||||
velocity.X = Mathf.Clamp(velocity.X, -AirMaxSpeed, AirMaxSpeed);
|
velocity.X = Mathf.Clamp(velocity.X, -AirMaxSpeed, AirMaxSpeed);
|
||||||
}
|
}
|
||||||
|
|
||||||
dragAmount = _currentDirection.IsZeroApprox() ? 0.015f : 0.009f;
|
dragAmount = _currentDirection.IsZeroApprox() ? 0.015f : 0.009f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -263,17 +278,17 @@ public sealed partial class Player : CharacterBody2D, IAttackable, IHitboxOwner,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IsOnFloor())
|
if (IsOnFloor() && !IsInWater)
|
||||||
JumpAllowedTimer.Start();
|
JumpAllowedTimer.Start();
|
||||||
{
|
{
|
||||||
var addedDashPoints = 3f * deltaF;
|
var addedDashPoints = DashPointRate * deltaF;
|
||||||
if (IsInWater)
|
if (IsInWater)
|
||||||
{
|
{
|
||||||
DashPoints += BankedDashPoints;
|
DashPoints += BankedDashPoints;
|
||||||
BankedDashPoints = 0;
|
BankedDashPoints = 0;
|
||||||
DashPoints = Mathf.Min(MaxDashPoints, DashPoints + addedDashPoints);
|
DashPoints = Mathf.Min(MaxDashPoints, DashPoints + addedDashPoints);
|
||||||
}
|
}
|
||||||
else BankedDashPoints = Mathf.Min(1, BankedDashPoints + 3f * addedDashPoints);
|
else BankedDashPoints = Mathf.Min(1f, BankedDashPoints + addedDashPoints);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IsOnCeiling()) JumpTimer.Stop();
|
if (IsOnCeiling()) JumpTimer.Stop();
|
||||||
|
|
@ -436,6 +451,7 @@ public sealed partial class Player : CharacterBody2D, IAttackable, IHitboxOwner,
|
||||||
if (Velocity.Y < 0)
|
if (Velocity.Y < 0)
|
||||||
Velocity *= new Vector2(1f, 0.1f);
|
Velocity *= new Vector2(1f, 0.1f);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!WallJumpTimer.IsStopped())
|
if (!WallJumpTimer.IsStopped())
|
||||||
{
|
{
|
||||||
WallJumpTimer.Stop();
|
WallJumpTimer.Stop();
|
||||||
|
|
|
||||||
|
|
@ -13,19 +13,42 @@ public partial class PlayerHud : Control
|
||||||
[Node] private Polygon2D EnergyBar0 { get; set; } = null!;
|
[Node] private Polygon2D EnergyBar0 { get; set; } = null!;
|
||||||
[Node] private Polygon2D EnergyBar1 { get; set; } = null!;
|
[Node] private Polygon2D EnergyBar1 { get; set; } = null!;
|
||||||
|
|
||||||
public void OnReady() => SetProcess(true);
|
private Polygon2D[] _energyBars = null!;
|
||||||
|
private float[] _previousEnergyRatios = [0f, 0f];
|
||||||
|
|
||||||
|
public void OnReady()
|
||||||
|
{
|
||||||
|
_energyBars = [EnergyBar0, EnergyBar1];
|
||||||
|
SetProcess(true);
|
||||||
|
}
|
||||||
|
|
||||||
public void OnProcess(double delta)
|
public void OnProcess(double delta)
|
||||||
{
|
{
|
||||||
((ShaderMaterial)HpBar.Material).SetShaderParameter("ratios",
|
((ShaderMaterial)HpBar.Material).SetShaderParameter("ratios",
|
||||||
stackalloc float[] { 0f, 0f, Player.Health / Player.MaxHealth, 0f });
|
stackalloc float[] { 0f, 0f, Player.Health / Player.MaxHealth, 0f });
|
||||||
|
|
||||||
var energy0Fill = Mathf.Clamp(Player.DashPoints - 0f, 0f, 1f);
|
Span<float> ratios = stackalloc float[_energyBars.Length * 4];
|
||||||
((ShaderMaterial)EnergyBar0.Material).SetShaderParameter("ratios",
|
for (var idx = 0; idx < _energyBars.Length; idx++)
|
||||||
stackalloc float[] { 0f, 0f, energy0Fill, 0f });
|
{
|
||||||
|
var bar = _energyBars[idx];
|
||||||
|
var previousFill = _previousEnergyRatios[idx];
|
||||||
|
|
||||||
var energy1Fill = Mathf.Clamp(Player.DashPoints - 1f, 0f, 1f);
|
var fill = Mathf.Clamp(Player.DashPoints - idx, 0f, 1f);
|
||||||
((ShaderMaterial)EnergyBar1.Material).SetShaderParameter("ratios",
|
|
||||||
stackalloc float[] { 0f, 0f, energy1Fill, 0f });
|
if (previousFill < 1f && fill >= 1f)
|
||||||
|
{
|
||||||
|
CreateTween().TweenProperty(bar, "scale", Vector2.One, 0.3f)
|
||||||
|
.From(Vector2.One * 1.5f)
|
||||||
|
.SetEase(Tween.EaseType.Out);
|
||||||
|
}
|
||||||
|
|
||||||
|
var extra = Mathf.Clamp(Player.DashPoints + Player.BankedDashPoints - idx, 0f, 1f);
|
||||||
|
ratios[0] = 0f;
|
||||||
|
ratios[1] = extra;
|
||||||
|
ratios[2] = fill;
|
||||||
|
ratios[3] = fill >= 1f ? 1f : 0f;
|
||||||
|
((ShaderMaterial)bar.Material).SetShaderParameter("ratios", ratios);
|
||||||
|
_previousEnergyRatios[idx] = fill;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
BIN
src/ui/energy_bar.aseprite
(Stored with Git LFS)
BIN
src/ui/energy_bar.aseprite
(Stored with Git LFS)
Binary file not shown.
BIN
src/ui/energy_bar.png
(Stored with Git LFS)
BIN
src/ui/energy_bar.png
(Stored with Git LFS)
Binary file not shown.
|
|
@ -1,40 +0,0 @@
|
||||||
[remap]
|
|
||||||
|
|
||||||
importer="texture"
|
|
||||||
type="CompressedTexture2D"
|
|
||||||
uid="uid://dwiu5ej85fc3i"
|
|
||||||
path="res://.godot/imported/energy_bar.png-02c88baf398c7dd6c09b262e160b55f4.ctex"
|
|
||||||
metadata={
|
|
||||||
"vram_texture": false
|
|
||||||
}
|
|
||||||
|
|
||||||
[deps]
|
|
||||||
|
|
||||||
source_file="res://src/ui/energy_bar.png"
|
|
||||||
dest_files=["res://.godot/imported/energy_bar.png-02c88baf398c7dd6c09b262e160b55f4.ctex"]
|
|
||||||
|
|
||||||
[params]
|
|
||||||
|
|
||||||
compress/mode=0
|
|
||||||
compress/high_quality=false
|
|
||||||
compress/lossy_quality=0.7
|
|
||||||
compress/uastc_level=0
|
|
||||||
compress/rdo_quality_loss=0.0
|
|
||||||
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/channel_remap/red=0
|
|
||||||
process/channel_remap/green=1
|
|
||||||
process/channel_remap/blue=2
|
|
||||||
process/channel_remap/alpha=3
|
|
||||||
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
src/ui/hp_bar.aseprite
(Stored with Git LFS)
BIN
src/ui/hp_bar.aseprite
(Stored with Git LFS)
Binary file not shown.
BIN
src/ui/hp_bar.png
(Stored with Git LFS)
BIN
src/ui/hp_bar.png
(Stored with Git LFS)
Binary file not shown.
|
|
@ -1,40 +0,0 @@
|
||||||
[remap]
|
|
||||||
|
|
||||||
importer="texture"
|
|
||||||
type="CompressedTexture2D"
|
|
||||||
uid="uid://c0kdbshy1ipbe"
|
|
||||||
path="res://.godot/imported/hp_bar.png-dad149f5958edda274a5b787fdfb48fd.ctex"
|
|
||||||
metadata={
|
|
||||||
"vram_texture": false
|
|
||||||
}
|
|
||||||
|
|
||||||
[deps]
|
|
||||||
|
|
||||||
source_file="res://src/ui/hp_bar.png"
|
|
||||||
dest_files=["res://.godot/imported/hp_bar.png-dad149f5958edda274a5b787fdfb48fd.ctex"]
|
|
||||||
|
|
||||||
[params]
|
|
||||||
|
|
||||||
compress/mode=0
|
|
||||||
compress/high_quality=false
|
|
||||||
compress/lossy_quality=0.7
|
|
||||||
compress/uastc_level=0
|
|
||||||
compress/rdo_quality_loss=0.0
|
|
||||||
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/channel_remap/red=0
|
|
||||||
process/channel_remap/green=1
|
|
||||||
process/channel_remap/blue=2
|
|
||||||
process/channel_remap/alpha=3
|
|
||||||
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
src/ui/player_hud.aseprite
(Stored with Git LFS)
BIN
src/ui/player_hud.aseprite
(Stored with Git LFS)
Binary file not shown.
BIN
src/ui/player_hud.png
(Stored with Git LFS)
BIN
src/ui/player_hud.png
(Stored with Git LFS)
Binary file not shown.
|
|
@ -1,40 +0,0 @@
|
||||||
[remap]
|
|
||||||
|
|
||||||
importer="texture"
|
|
||||||
type="CompressedTexture2D"
|
|
||||||
uid="uid://b7xxxshusx3sm"
|
|
||||||
path="res://.godot/imported/player_hud.png-9842985ced4432e20f5da32d9c77546a.ctex"
|
|
||||||
metadata={
|
|
||||||
"vram_texture": false
|
|
||||||
}
|
|
||||||
|
|
||||||
[deps]
|
|
||||||
|
|
||||||
source_file="res://src/ui/player_hud.png"
|
|
||||||
dest_files=["res://.godot/imported/player_hud.png-9842985ced4432e20f5da32d9c77546a.ctex"]
|
|
||||||
|
|
||||||
[params]
|
|
||||||
|
|
||||||
compress/mode=0
|
|
||||||
compress/high_quality=false
|
|
||||||
compress/lossy_quality=0.7
|
|
||||||
compress/uastc_level=0
|
|
||||||
compress/rdo_quality_loss=0.0
|
|
||||||
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/channel_remap/red=0
|
|
||||||
process/channel_remap/green=1
|
|
||||||
process/channel_remap/blue=2
|
|
||||||
process/channel_remap/alpha=3
|
|
||||||
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
|
|
||||||
|
|
@ -15,6 +15,7 @@ shader = ExtResource("3_gukev")
|
||||||
shader_parameter/ratios = PackedFloat32Array(0, 0, 0.765, 0)
|
shader_parameter/ratios = PackedFloat32Array(0, 0, 0.765, 0)
|
||||||
shader_parameter/empty_color = Color(0.12955844, 0.12955847, 0.12955844, 1)
|
shader_parameter/empty_color = Color(0.12955844, 0.12955847, 0.12955844, 1)
|
||||||
shader_parameter/colors = PackedColorArray(0, 0, 0, 1, 0, 0, 0, 1, 0.15294118, 0.827451, 0.79607844, 1, 0, 0, 0, 1)
|
shader_parameter/colors = PackedColorArray(0, 0, 0, 1, 0, 0, 0, 1, 0.15294118, 0.827451, 0.79607844, 1, 0, 0, 0, 1)
|
||||||
|
shader_parameter/cheat_amount = 0.0
|
||||||
shader_parameter/frequency = 0.125
|
shader_parameter/frequency = 0.125
|
||||||
shader_parameter/amplitude = 1.0
|
shader_parameter/amplitude = 1.0
|
||||||
|
|
||||||
|
|
@ -26,7 +27,8 @@ resource_local_to_scene = true
|
||||||
shader = ExtResource("3_gukev")
|
shader = ExtResource("3_gukev")
|
||||||
shader_parameter/ratios = PackedFloat32Array(0, 0, 0.765, 0)
|
shader_parameter/ratios = PackedFloat32Array(0, 0, 0.765, 0)
|
||||||
shader_parameter/empty_color = Color(0.12955844, 0.12955847, 0.12955844, 1)
|
shader_parameter/empty_color = Color(0.12955844, 0.12955847, 0.12955844, 1)
|
||||||
shader_parameter/colors = PackedColorArray(0, 0, 0, 1, 0, 0, 0, 1, 1, 0.43137255, 0.6862745, 1, 0, 0, 0, 1)
|
shader_parameter/colors = PackedColorArray(0, 0, 0, 1, 0.5137255, 0.10980392, 0.3647059, 1, 0.9411765, 0.30980393, 0.47058824, 1, 1, 1, 1, 1)
|
||||||
|
shader_parameter/cheat_amount = 0.15
|
||||||
shader_parameter/frequency = 0.125
|
shader_parameter/frequency = 0.125
|
||||||
shader_parameter/amplitude = 1.0
|
shader_parameter/amplitude = 1.0
|
||||||
|
|
||||||
|
|
@ -35,7 +37,8 @@ resource_local_to_scene = true
|
||||||
shader = ExtResource("3_gukev")
|
shader = ExtResource("3_gukev")
|
||||||
shader_parameter/ratios = PackedFloat32Array(0, 0, 0.765, 0)
|
shader_parameter/ratios = PackedFloat32Array(0, 0, 0.765, 0)
|
||||||
shader_parameter/empty_color = Color(0.12955844, 0.12955847, 0.12955844, 1)
|
shader_parameter/empty_color = Color(0.12955844, 0.12955847, 0.12955844, 1)
|
||||||
shader_parameter/colors = PackedColorArray(0, 0, 0, 1, 0, 0, 0, 1, 1, 0.43137255, 0.6862745, 1, 0, 0, 0, 1)
|
shader_parameter/colors = PackedColorArray(0, 0, 0, 1, 0.5137255, 0.10980392, 0.3647059, 1, 0.9411765, 0.30980393, 0.47058824, 1, 1, 1, 1, 1)
|
||||||
|
shader_parameter/cheat_amount = 0.15
|
||||||
shader_parameter/frequency = 0.125
|
shader_parameter/frequency = 0.125
|
||||||
shader_parameter/amplitude = 1.0
|
shader_parameter/amplitude = 1.0
|
||||||
|
|
||||||
|
|
@ -61,6 +64,8 @@ uv = PackedVector2Array(0.18070698, 7.5369415, 31.720398, 1.6552172, 31.191221,
|
||||||
[node name="EnergyBar0" type="Polygon2D" parent="." unique_id=800795938]
|
[node name="EnergyBar0" type="Polygon2D" parent="." unique_id=800795938]
|
||||||
unique_name_in_owner = true
|
unique_name_in_owner = true
|
||||||
material = SubResource("ShaderMaterial_i7kvj")
|
material = SubResource("ShaderMaterial_i7kvj")
|
||||||
|
position = Vector2(14, 19)
|
||||||
|
offset = Vector2(-14, -19)
|
||||||
texture = SubResource("PlaceholderTexture2D_wcly6")
|
texture = SubResource("PlaceholderTexture2D_wcly6")
|
||||||
polygon = PackedVector2Array(8, 16, 24, 17, 19, 24, 6, 22)
|
polygon = PackedVector2Array(8, 16, 24, 17, 19, 24, 6, 22)
|
||||||
uv = PackedVector2Array(-0.058876038, 12.0672, 31.749325, -0.97031116, 28.649677, 17.21373, 1.6946745, 25.515366)
|
uv = PackedVector2Array(-0.058876038, 12.0672, 31.749325, -0.97031116, 28.649677, 17.21373, 1.6946745, 25.515366)
|
||||||
|
|
@ -68,6 +73,8 @@ uv = PackedVector2Array(-0.058876038, 12.0672, 31.749325, -0.97031116, 28.649677
|
||||||
[node name="EnergyBar1" type="Polygon2D" parent="." unique_id=2035511932]
|
[node name="EnergyBar1" type="Polygon2D" parent="." unique_id=2035511932]
|
||||||
unique_name_in_owner = true
|
unique_name_in_owner = true
|
||||||
material = SubResource("ShaderMaterial_1dykc")
|
material = SubResource("ShaderMaterial_1dykc")
|
||||||
|
position = Vector2(32, 22)
|
||||||
|
offset = Vector2(-32, -22)
|
||||||
texture = SubResource("PlaceholderTexture2D_wcly6")
|
texture = SubResource("PlaceholderTexture2D_wcly6")
|
||||||
polygon = PackedVector2Array(28, 18, 45, 19, 34, 27, 22, 25)
|
polygon = PackedVector2Array(28, 18, 45, 19, 34, 27, 22, 25)
|
||||||
uv = PackedVector2Array(1.3059769, 25.891489, 31.327286, -2.5226192, 27.199902, 30.23344, 3.7188683, 48.139774)
|
uv = PackedVector2Array(1.3059769, 25.891489, 31.327286, -2.5226192, 27.199902, 30.23344, 3.7188683, 48.139774)
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ const int count = 4;
|
||||||
uniform float ratios[count];
|
uniform float ratios[count];
|
||||||
uniform vec3 empty_color : source_color;
|
uniform vec3 empty_color : source_color;
|
||||||
uniform vec3 colors[count] : source_color;
|
uniform vec3 colors[count] : source_color;
|
||||||
|
uniform float cheat_amount = 0.0;
|
||||||
|
|
||||||
uniform float frequency = 1.0;
|
uniform float frequency = 1.0;
|
||||||
uniform float amplitude = 1.0;
|
uniform float amplitude = 1.0;
|
||||||
|
|
@ -19,6 +20,7 @@ void fragment() {
|
||||||
vec3 base_color = empty_color;
|
vec3 base_color = empty_color;
|
||||||
for (int idx = 0; idx < count; idx++) {
|
for (int idx = 0; idx < count; idx++) {
|
||||||
float ratio = ratios[idx];
|
float ratio = ratios[idx];
|
||||||
|
if (ratio < 1.0) ratio *= 1.0 - cheat_amount;
|
||||||
vec3 fill_color = colors[idx];
|
vec3 fill_color = colors[idx];
|
||||||
if (ratio >= UV.x)
|
if (ratio >= UV.x)
|
||||||
base_color = fill_color;
|
base_color = fill_color;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue