-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#6: Update to improve light saber effects/rifile effects/boost trail …
…effects
- Loading branch information
Danil Ko
committed
Mar 21, 2021
1 parent
4e0a444
commit 610552b
Showing
8 changed files
with
113 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
using Godot; | ||
using System; | ||
|
||
public class Trail : Node | ||
{ | ||
[Export] | ||
private int _length = 10; | ||
|
||
[Export] | ||
private float _width = 10; | ||
|
||
|
||
private Line2D _line; | ||
|
||
public override void _Ready() | ||
{ | ||
_line = (Line2D)GetNode("Line"); | ||
|
||
_line.GlobalPosition = Vector2.Zero; | ||
_line.GlobalRotation = 0; | ||
_line.Width = _width; | ||
} | ||
|
||
public override void _PhysicsProcess(float delta) | ||
{ | ||
Vector2 _point = ((Node2D)(GetParent())).GlobalPosition; | ||
_line.AddPoint(_point); | ||
while (_line.GetPointCount() > _length) | ||
{ | ||
_line.RemovePoint(0); | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
[gd_scene load_steps=4 format=2] | ||
|
||
[ext_resource path="res://effects/Trail.cs" type="Script" id=1] | ||
|
||
[sub_resource type="Curve" id=1] | ||
_data = [ Vector2( 0, 0.490909 ), 0.0, 0.0, 0, 0, Vector2( 1, 1 ), 0.0, 0.0, 0, 0 ] | ||
|
||
[sub_resource type="Gradient" id=2] | ||
colors = PoolColorArray( 0.87451, 0.87451, 0.87451, 0.470588, 0.617676, 0.988281, 0.988281, 0.792157 ) | ||
|
||
[node name="Trail" type="Node"] | ||
script = ExtResource( 1 ) | ||
|
||
[node name="Line" type="Line2D" parent="."] | ||
width_curve = SubResource( 1 ) | ||
gradient = SubResource( 2 ) | ||
joint_mode = 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters