target tracer transparency
parent
456236afdb
commit
59d2def8a9
|
@ -71,7 +71,15 @@ public sealed partial class Player : Character
|
|||
{
|
||||
base._Process(delta);
|
||||
|
||||
_targetTracer.Rotation = DesiredTarget.Angle();
|
||||
float angle = DesiredTarget.Angle();
|
||||
float deltaTheta = Mathf.Abs(_targetTracer.Rotation - angle);
|
||||
_targetTracer.Rotation = angle;
|
||||
// must turn > pi / 4 radians per second to increase intensity
|
||||
_targetTracer.Intensity = Mathf.Min(_targetTracer.Intensity +
|
||||
deltaTheta, 1);
|
||||
_targetTracer.Intensity = Mathf.Max(_targetTracer.Intensity -
|
||||
Mathf.Pi / 4 * (float)delta, 0);
|
||||
GD.Print(_targetTracer.Intensity);
|
||||
}
|
||||
|
||||
public override void _Input(InputEvent @event)
|
||||
|
|
|
@ -245,9 +245,9 @@ tracks/2/keys = {
|
|||
"values": [false]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_3w3u1"]
|
||||
resource_name = "sword"
|
||||
length = 0.3
|
||||
[sub_resource type="Animation" id="Animation_audkv"]
|
||||
resource_name = "heal"
|
||||
loop_mode = 1
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
|
@ -255,10 +255,22 @@ tracks/0/path = NodePath("%Sprites/Node2D/Character:frame")
|
|||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0, 0.1, 0.2),
|
||||
"transitions": PackedFloat32Array(1, 1, 1),
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 1,
|
||||
"values": [12, 13, 14]
|
||||
"values": [35]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath("%Effects/HealParticles:emitting")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 1,
|
||||
"values": [true]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_60iyy"]
|
||||
|
@ -277,22 +289,6 @@ tracks/0/keys = {
|
|||
"values": [false]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_6twa8"]
|
||||
resource_name = "heal_start"
|
||||
length = 0.25
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("%Sprites/Node2D/Character:frame")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 1,
|
||||
"values": [35]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_dyfl4"]
|
||||
resource_name = "heal_end"
|
||||
length = 0.001
|
||||
|
@ -321,9 +317,9 @@ tracks/1/keys = {
|
|||
"values": [true]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_audkv"]
|
||||
resource_name = "heal"
|
||||
loop_mode = 1
|
||||
[sub_resource type="Animation" id="Animation_6twa8"]
|
||||
resource_name = "heal_start"
|
||||
length = 0.25
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
|
@ -336,17 +332,21 @@ tracks/0/keys = {
|
|||
"update": 1,
|
||||
"values": [35]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath("%Effects/HealParticles:emitting")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
|
||||
[sub_resource type="Animation" id="Animation_3w3u1"]
|
||||
resource_name = "sword"
|
||||
length = 0.3
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("%Sprites/Node2D/Character:frame")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0, 0.1, 0.2),
|
||||
"transitions": PackedFloat32Array(1, 1, 1),
|
||||
"update": 1,
|
||||
"values": [true]
|
||||
"values": [12, 13, 14]
|
||||
}
|
||||
|
||||
[sub_resource type="AnimationLibrary" id="AnimationLibrary_73mj7"]
|
||||
|
|
|
@ -1,8 +1,11 @@
|
|||
shader_type canvas_item;
|
||||
render_mode blend_mix;
|
||||
|
||||
uniform float speed = 16;
|
||||
uniform vec2 direction = vec2(1, 0);
|
||||
uniform vec4 tint_color : source_color;
|
||||
|
||||
void fragment() {
|
||||
COLOR = texture(TEXTURE, UV - direction * TIME * speed);
|
||||
vec4 color = texture(TEXTURE, UV - direction * TIME * speed);
|
||||
COLOR = color * tint_color;
|
||||
}
|
||||
|
|
|
@ -4,12 +4,17 @@ public partial class TargetTracer : Node2D
|
|||
{
|
||||
private Line2D _line;
|
||||
|
||||
private float Intensity
|
||||
private float _intensity = 127;
|
||||
|
||||
public float Intensity
|
||||
{
|
||||
get => SelfModulate.A;
|
||||
get => _intensity;
|
||||
set
|
||||
{
|
||||
SelfModulate = new Color(SelfModulate, value);
|
||||
var color = new Color(Colors.White, value);
|
||||
(Material as ShaderMaterial)
|
||||
.SetShaderParameter("tint_color", color);
|
||||
_intensity = value;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -3,10 +3,11 @@
|
|||
[ext_resource type="Shader" path="res://Shaders/Scrolling.gdshader" id="1_1y0lt"]
|
||||
[ext_resource type="Script" path="res://UI/TargetTracer.cs" id="1_mtnfa"]
|
||||
|
||||
[sub_resource type="ShaderMaterial" id="ShaderMaterial_hcccp"]
|
||||
[sub_resource type="ShaderMaterial" id="ShaderMaterial_46g0j"]
|
||||
shader = ExtResource("1_1y0lt")
|
||||
shader_parameter/speed = 1.0
|
||||
shader_parameter/direction = Vector2(1, 0)
|
||||
shader_parameter/tint_color = Color(1, 1, 1, 1)
|
||||
|
||||
[sub_resource type="Gradient" id="Gradient_0wna6"]
|
||||
interpolation_mode = 1
|
||||
|
@ -19,12 +20,13 @@ width = 2
|
|||
height = 1
|
||||
|
||||
[node name="TargetTracer" type="Node2D"]
|
||||
material = SubResource("ShaderMaterial_46g0j")
|
||||
script = ExtResource("1_mtnfa")
|
||||
|
||||
[node name="Line2D" type="Line2D" parent="."]
|
||||
z_index = 31
|
||||
texture_repeat = 2
|
||||
material = SubResource("ShaderMaterial_hcccp")
|
||||
use_parent_material = true
|
||||
scale = Vector2(1, 0.5)
|
||||
points = PackedVector2Array(0, 0, 32, 0)
|
||||
width = 2.0
|
||||
|
|
Loading…
Reference in New Issue