SLAPPENING

This commit is contained in:
MarcEricMartel 2022-10-11 13:08:21 -04:00
parent f498d08238
commit dbae4ba248
2 changed files with 27 additions and 18 deletions

View File

@ -8,7 +8,8 @@ export var normal_acceleration = 6
export var gravity = 100 export var gravity = 100
export var jump = 30 export var jump = 30
var slap = 0.0 var slap = 0.0
var isSlap = false var chargeSlap = false
var isSlap = false;
export var mouse_sensitivity = 0.03 export var mouse_sensitivity = 0.03
@ -67,24 +68,22 @@ func _physics_process(delta):
elif Input.is_action_pressed("move_right"): elif Input.is_action_pressed("move_right"):
direction += transform.basis.x direction += transform.basis.x
if Input.is_action_just_released("slap"): # Slappening
isSlap = false; if Input.is_action_just_pressed("slap"):
elif Input.is_action_just_pressed("slap"): chargeSlap = true;
elif Input.is_action_just_released("slap"):
chargeSlap = false;
isSlap = true; isSlap = true;
if (isSlap):
slap += delta;
else: else:
slap -= delta * 4.0; isSlap = false;
if (chargeSlap):
slap = clamp(slap, 0.0, 1.1) slap += delta * 1.5;
else:
if (slap > 1.0 && isSlap): slap -= delta * 8.0;
isSlap = false slap = clamp(slap, 0.0, 1.0)
slap = 0.0;
get_node("/root/Spatial/HUD/ActualHUD/SlapGauge").fill = slap; get_node("/root/Spatial/HUD/ActualHUD/SlapGauge").fill = slap;
direction = direction.normalized() direction = direction.normalized()
h_velocity = h_velocity.linear_interpolate(direction * speed, h_acceleration * delta) h_velocity = h_velocity.linear_interpolate(direction * speed, h_acceleration * delta)
movement.z = h_velocity.z + gravity_vec.z movement.z = h_velocity.z + gravity_vec.z

View File

@ -69,13 +69,23 @@ uniform vec4 bkgcol = vec4(0.0, 0.0, 0.0, 0.3);
uniform vec4 kilcol = vec4(0.5, 0.0, 0.0, 0.3); uniform vec4 kilcol = vec4(0.5, 0.0, 0.0, 0.3);
void fragment() { void fragment() {
bool is = false;
if (fill >= UV.x) { if (fill >= UV.x) {
COLOR = vec4(UV.x,-UV.x + .5,-UV.x + 1.0,1.0); COLOR = vec4(UV.x,-UV.x + .5,-UV.x + 1.0,1.0);
COLOR.rgb *= vec3(cos(UV.y * 2.0) / 1.5,cos(UV.y * 2.0) / 1.5,cos(UV.y * 2.0) / 1.5); COLOR.rgb *= vec3(cos(UV.y * 2.0) / 1.5,cos(UV.y * 2.0) / 1.5,cos(UV.y * 2.0) / 1.5);
is = true;
if (kill >= UV.x)
COLOR.rgb += vec3(0.1,0.1,0.1);
} }
else if (UV.x >= kill) else if (UV.x > kill + 0.001)
COLOR = kilcol; COLOR = kilcol;
else COLOR = bkgcol; else COLOR = bkgcol;
if ((UV.y < .2 || UV.y > 0.8) && (UV.x > kill + 0.001 || UV.x < kill - 0.001) && !is)
COLOR.a = 0.05;
}" }"
[sub_resource type="ShaderMaterial" id=7] [sub_resource type="ShaderMaterial" id=7]