diff --git a/Player.gd b/Player.gd index 9db4d45..5f9f66a 100644 --- a/Player.gd +++ b/Player.gd @@ -8,7 +8,8 @@ export var normal_acceleration = 6 export var gravity = 100 export var jump = 30 var slap = 0.0 -var isSlap = false +var chargeSlap = false +var isSlap = false; export var mouse_sensitivity = 0.03 @@ -66,25 +67,23 @@ func _physics_process(delta): direction -= transform.basis.x elif Input.is_action_pressed("move_right"): direction += transform.basis.x - - if Input.is_action_just_released("slap"): - isSlap = false; - elif Input.is_action_just_pressed("slap"): + + # Slappening + if Input.is_action_just_pressed("slap"): + chargeSlap = true; + elif Input.is_action_just_released("slap"): + chargeSlap = false; isSlap = true; - - - if (isSlap): - slap += delta; + else: + isSlap = false; + if (chargeSlap): + slap += delta * 1.5; else: - slap -= delta * 4.0; - - slap = clamp(slap, 0.0, 1.1) - - if (slap > 1.0 && isSlap): - isSlap = false - slap = 0.0; - + slap -= delta * 8.0; + slap = clamp(slap, 0.0, 1.0) get_node("/root/Spatial/HUD/ActualHUD/SlapGauge").fill = slap; + + direction = direction.normalized() h_velocity = h_velocity.linear_interpolate(direction * speed, h_acceleration * delta) movement.z = h_velocity.z + gravity_vec.z diff --git a/Test_Scene.tscn b/Test_Scene.tscn index fca0bfd..7b8d312 100644 --- a/Test_Scene.tscn +++ b/Test_Scene.tscn @@ -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); void fragment() { + bool is = false; if (fill >= UV.x) { 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); + 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; 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]