fuzzyworld

godot-shooter / commit

Added a "laser" that points in the current direction.

9de17d96cd73454e2284399144fbfdf047d8386b · Pavel Safronov · 2023-11-07 16:58:14 -0800 · parents 97a9ab3d03d0

Added a "laser" that points in the current direction.
 Player.tscn | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/Player.tscn b/Player.tscn
index 801bcd1..415a8ae 100644
--- a/Player.tscn
+++ b/Player.tscn
@@ -1,4 +1,4 @@
-[gd_scene load_steps=8 format=2]
+[gd_scene load_steps=9 format=2]
 
 [ext_resource path="res://assets/kenney_simple-space/PNG/Default/ship_sidesA.png" type="Texture" id=1]
 [ext_resource path="res://Explosion.tscn" type="PackedScene" id=2]
@@ -7,6 +7,9 @@
 [ext_resource path="res://CharacterTheme.tres" type="Theme" id=5]
 [ext_resource path="res://Trails.tscn" type="PackedScene" id=6]
 
+[sub_resource type="Gradient" id=2]
+colors = PoolColorArray( 1, 0, 0, 1, 1, 0, 0, 0 )
+
 [sub_resource type="Gradient" id=1]
 colors = PoolColorArray( 0, 0, 0, 0, 0, 1, 0, 1 )
 
@@ -20,7 +23,15 @@ polygon = PoolVector2Array( -0.996349, -22.0002, -8.00133, 7.99867, -7.00166, 9.
 
 [node name="Graphics" type="Node2D" parent="."]
 
-[node name="Alive" type="Sprite" parent="Graphics"]
+[node name="Alive" type="Node2D" parent="Graphics"]
+
+[node name="Line2D" type="Line2D" parent="Graphics/Alive"]
+points = PoolVector2Array( 0, 0, 0, -300 )
+width = 2.0
+default_color = Color( 1, 0, 0, 1 )
+gradient = SubResource( 2 )
+
+[node name="Sprite" type="Sprite" parent="Graphics/Alive"]
 modulate = Color( 0, 1, 0, 1 )
 texture = ExtResource( 1 )