target tracers
parent
a7b75a8ba1
commit
bd276dffc3
|
@ -11,6 +11,8 @@ public sealed partial class Player : Character
|
||||||
{
|
{
|
||||||
private string _spriteAnim;
|
private string _spriteAnim;
|
||||||
|
|
||||||
|
private TargetTracer _targetTracer;
|
||||||
|
|
||||||
public Vector2 DesiredTarget { get; set; }
|
public Vector2 DesiredTarget { get; set; }
|
||||||
|
|
||||||
[Export]
|
[Export]
|
||||||
|
@ -28,6 +30,8 @@ public sealed partial class Player : Character
|
||||||
{
|
{
|
||||||
InteractionRay = GetNode<InteractionRay>("Direction2D/InteractionRay");
|
InteractionRay = GetNode<InteractionRay>("Direction2D/InteractionRay");
|
||||||
|
|
||||||
|
_targetTracer = GetNode<TargetTracer>("%TargetTracer");
|
||||||
|
|
||||||
base._Ready();
|
base._Ready();
|
||||||
|
|
||||||
Inventory.UsedItem += (Items.Item item) =>
|
Inventory.UsedItem += (Items.Item item) =>
|
||||||
|
@ -48,6 +52,8 @@ public sealed partial class Player : Character
|
||||||
public override void _Process(double delta)
|
public override void _Process(double delta)
|
||||||
{
|
{
|
||||||
base._Process(delta);
|
base._Process(delta);
|
||||||
|
|
||||||
|
_targetTracer.Rotation = DesiredTarget.Angle();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void _Input(InputEvent @event)
|
public override void _Input(InputEvent @event)
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
[gd_scene load_steps=66 format=3 uid="uid://b2254pup8k161"]
|
[gd_scene load_steps=67 format=3 uid="uid://b2254pup8k161"]
|
||||||
|
|
||||||
[ext_resource type="Script" path="res://Characters/Player.cs" id="1_flygr"]
|
[ext_resource type="Script" path="res://Characters/Player.cs" id="1_flygr"]
|
||||||
[ext_resource type="Shader" path="res://Shaders/Flash.gdshader" id="2_ngsgt"]
|
[ext_resource type="Shader" path="res://Shaders/Flash.gdshader" id="2_ngsgt"]
|
||||||
|
@ -31,6 +31,7 @@
|
||||||
[ext_resource type="Texture2D" uid="uid://d1ukste16yq6v" path="res://Assets/Sprites/Particles/player-light.png" id="15_3hahh"]
|
[ext_resource type="Texture2D" uid="uid://d1ukste16yq6v" path="res://Assets/Sprites/Particles/player-light.png" id="15_3hahh"]
|
||||||
[ext_resource type="Script" path="res://Utils/DamageTime.cs" id="15_4xl06"]
|
[ext_resource type="Script" path="res://Utils/DamageTime.cs" id="15_4xl06"]
|
||||||
[ext_resource type="PackedScene" uid="uid://g7wfcubs6bdd" path="res://Items/Weapons/Railgun.tscn" id="21_n8w32"]
|
[ext_resource type="PackedScene" uid="uid://g7wfcubs6bdd" path="res://Items/Weapons/Railgun.tscn" id="21_n8w32"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://ce0ph4wk0ylra" path="res://UI/TargetTracer.tscn" id="22_hxi53"]
|
||||||
[ext_resource type="PackedScene" uid="uid://5y1acxl4j4n7" path="res://Items/Weapons/Pugio.tscn" id="22_mqpn7"]
|
[ext_resource type="PackedScene" uid="uid://5y1acxl4j4n7" path="res://Items/Weapons/Pugio.tscn" id="22_mqpn7"]
|
||||||
[ext_resource type="PackedScene" uid="uid://d1d4vg7we5rjr" path="res://Items/Weapons/Shotgun.tscn" id="22_rmciq"]
|
[ext_resource type="PackedScene" uid="uid://d1d4vg7we5rjr" path="res://Items/Weapons/Shotgun.tscn" id="22_rmciq"]
|
||||||
|
|
||||||
|
@ -452,6 +453,10 @@ stream = ExtResource("13_bxguv")
|
||||||
[node name="HurtSound" type="AudioStreamPlayer2D" parent="Effects"]
|
[node name="HurtSound" type="AudioStreamPlayer2D" parent="Effects"]
|
||||||
stream = ExtResource("12_vvem5")
|
stream = ExtResource("12_vvem5")
|
||||||
|
|
||||||
|
[node name="TargetTracer" parent="Effects" instance=ExtResource("22_hxi53")]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
position = Vector2(0, -4)
|
||||||
|
|
||||||
[node name="Camera2D" parent="." instance=ExtResource("4_ym125")]
|
[node name="Camera2D" parent="." instance=ExtResource("4_ym125")]
|
||||||
zoom = Vector2(4, 4)
|
zoom = Vector2(4, 4)
|
||||||
position_smoothing_speed = 8.0
|
position_smoothing_speed = 8.0
|
||||||
|
@ -513,6 +518,9 @@ UseTime = 0.2
|
||||||
|
|
||||||
[node name="DocLance" parent="Inventory" instance=ExtResource("14_bj0lo")]
|
[node name="DocLance" parent="Inventory" instance=ExtResource("14_bj0lo")]
|
||||||
|
|
||||||
|
[node name="RemoteTransform2D2" type="RemoteTransform2D" parent="Inventory"]
|
||||||
|
position = Vector2(0, 4)
|
||||||
|
|
||||||
[node name="Hurtbox" parent="." node_paths=PackedStringArray("InvincibilityTimer") instance=ExtResource("9_avyu4")]
|
[node name="Hurtbox" parent="." node_paths=PackedStringArray("InvincibilityTimer") instance=ExtResource("9_avyu4")]
|
||||||
visible = false
|
visible = false
|
||||||
InvincibilityTimer = NodePath("Timer")
|
InvincibilityTimer = NodePath("Timer")
|
||||||
|
@ -527,7 +535,6 @@ shape = SubResource("RectangleShape2D_cjk6b")
|
||||||
one_shot = true
|
one_shot = true
|
||||||
|
|
||||||
[node name="AudioListener2D" type="AudioListener2D" parent="."]
|
[node name="AudioListener2D" type="AudioListener2D" parent="."]
|
||||||
visible = false
|
|
||||||
current = true
|
current = true
|
||||||
|
|
||||||
[node name="Direction2D" type="Marker2D" parent="."]
|
[node name="Direction2D" type="Marker2D" parent="."]
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
shader_type canvas_item;
|
||||||
|
|
||||||
|
uniform float speed = 16;
|
||||||
|
uniform vec2 direction = vec2(1, 0);
|
||||||
|
|
||||||
|
void fragment() {
|
||||||
|
COLOR = texture(TEXTURE, UV - direction * TIME * speed);
|
||||||
|
}
|
|
@ -0,0 +1,20 @@
|
||||||
|
using Godot;
|
||||||
|
|
||||||
|
public partial class TargetTracer : Node2D
|
||||||
|
{
|
||||||
|
private Line2D _line;
|
||||||
|
|
||||||
|
private float Intensity
|
||||||
|
{
|
||||||
|
get => SelfModulate.A;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
SelfModulate = new Color(SelfModulate, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void _Ready()
|
||||||
|
{
|
||||||
|
_line = GetNode<Line2D>("Line2D");
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,32 @@
|
||||||
|
[gd_scene load_steps=6 format=3 uid="uid://ce0ph4wk0ylra"]
|
||||||
|
|
||||||
|
[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"]
|
||||||
|
shader = ExtResource("1_1y0lt")
|
||||||
|
shader_parameter/speed = 1.0
|
||||||
|
shader_parameter/direction = Vector2(1, 0)
|
||||||
|
|
||||||
|
[sub_resource type="Gradient" id="Gradient_0wna6"]
|
||||||
|
interpolation_mode = 1
|
||||||
|
offsets = PackedFloat32Array(0, 0.867133)
|
||||||
|
colors = PackedColorArray(1, 1, 1, 1, 1, 1, 1, 0)
|
||||||
|
|
||||||
|
[sub_resource type="GradientTexture2D" id="GradientTexture2D_icdwl"]
|
||||||
|
gradient = SubResource("Gradient_0wna6")
|
||||||
|
width = 2
|
||||||
|
height = 1
|
||||||
|
|
||||||
|
[node name="TargetTracer" type="Node2D"]
|
||||||
|
script = ExtResource("1_mtnfa")
|
||||||
|
|
||||||
|
[node name="Line2D" type="Line2D" parent="."]
|
||||||
|
z_index = 31
|
||||||
|
texture_repeat = 2
|
||||||
|
material = SubResource("ShaderMaterial_hcccp")
|
||||||
|
scale = Vector2(1, 0.5)
|
||||||
|
points = PackedVector2Array(0, 0, 32, 0)
|
||||||
|
width = 2.0
|
||||||
|
texture = SubResource("GradientTexture2D_icdwl")
|
||||||
|
texture_mode = 1
|
Loading…
Reference in New Issue