Skip to content

Commit

Permalink
#6: Update to improve light saber effects/rifile effects/boost trail …
Browse files Browse the repository at this point in the history
…effects
  • Loading branch information
Danil Ko committed Mar 21, 2021
1 parent 4e0a444 commit 610552b
Show file tree
Hide file tree
Showing 8 changed files with 113 additions and 18 deletions.
13 changes: 12 additions & 1 deletion agents/Agent.tscn
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[gd_scene load_steps=13 format=2]
[gd_scene load_steps=14 format=2]

[ext_resource path="res://agents/Agent.cs" type="Script" id=1]
[ext_resource path="res://effects/Explosion.tscn" type="PackedScene" id=2]
Expand All @@ -9,6 +9,7 @@
[ext_resource path="res://effects/AgentExplosionParticle.tscn" type="PackedScene" id=7]
[ext_resource path="res://inventory/Inventory.tscn" type="PackedScene" id=8]
[ext_resource path="res://assets/allSprites_retina_rotated.png" type="Texture" id=9]
[ext_resource path="res://effects/Trail.tscn" type="PackedScene" id=10]

[sub_resource type="CanvasItemMaterial" id=1]
blend_mode = 1
Expand All @@ -25,6 +26,8 @@ extents = Vector2( 29.5331, 50.0872 )
collision_layer = 15
script = ExtResource( 1 )

[node name="Node2D" type="Node2D" parent="."]

[node name="Body" type="Sprite" parent="."]
scale = Vector2( 0.5, 0.7 )
texture = ExtResource( 9 )
Expand Down Expand Up @@ -98,6 +101,10 @@ region_rect = Rect2( 0, 263, 95, 94 )
material = SubResource( 1 )
position = Vector2( 50, 0 )

[node name="Trail" parent="RightBooster" instance=ExtResource( 10 )]
_length = 30
_width = 20.0

[node name="LeftBooster" type="Sprite" parent="."]
position = Vector2( -31.395, -39.063 )
rotation = 3.14159
Expand All @@ -112,6 +119,10 @@ position = Vector2( 50, 0 )
lifetime = 0.8
speed_scale = 2.0

[node name="Trail" parent="LeftBooster" instance=ExtResource( 10 )]
_length = 30
_width = 20.0

[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
position = Vector2( 0.176773, 0 )
shape = SubResource( 3 )
Expand Down
2 changes: 2 additions & 0 deletions ai/TeamMapAI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -291,9 +291,11 @@ private void _assignDefaultWeapon(Agent agent)
// Add default wepaons
_inventoryManager.AddItem(_inventoryManager.GetPurchasableItemByID("SYC-600"), agent.GetInventory());
_inventoryManager.AddItem(_inventoryManager.GetPurchasableItemByID("SYC-800"), agent.GetInventory());
_inventoryManager.AddItem(_inventoryManager.GetPurchasableItemByID("SYC-200"), agent.GetInventory());

_inventoryManager.EquipItem(agent.GetInventory(), agent.GetInventory().GetItemIndex("SYC-600"), Weapon.WeaponOrder.Right, 0);
_inventoryManager.EquipItem(agent.GetInventory(), agent.GetInventory().GetItemIndex("SYC-800"), Weapon.WeaponOrder.Left, 0);
_inventoryManager.EquipItem(agent.GetInventory(), agent.GetInventory().GetItemIndex("SYC-200"), Weapon.WeaponOrder.Left, 1);
}
}

Expand Down
34 changes: 34 additions & 0 deletions effects/Trail.cs
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);
}
}

}
17 changes: 17 additions & 0 deletions effects/Trail.tscn
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
1 change: 1 addition & 0 deletions godot.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
<Compile Include="ai\TeamMapAISetting.cs" />
<Compile Include="effects\AgentExplosionParticle.cs" />
<Compile Include="effects\RemainParticles.cs" />
<Compile Include="effects\Trail.cs" />
<Compile Include="environments\CapaturableBaseManager.cs" />
<Compile Include="environments\CapturableBase.cs" />
<Compile Include="environments\ObstacleManager.cs" />
Expand Down
14 changes: 9 additions & 5 deletions projectiles/RifileBullet.tscn
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
[gd_scene load_steps=7 format=2]
[gd_scene load_steps=8 format=2]

[ext_resource path="res://projectiles/Projectile.tscn" type="PackedScene" id=1]
[ext_resource path="res://assets/allSprites_retina_rotated.png" type="Texture" id=2]
[ext_resource path="res://projectiles/RifileBullet.cs" type="Script" id=3]
[ext_resource path="res://effects/Trail.tscn" type="PackedScene" id=4]

[sub_resource type="CanvasItemMaterial" id=1]
blend_mode = 1

[sub_resource type="RectangleShape2D" id=2]
[sub_resource type="RectangleShape2D" id=3]
extents = Vector2( 29.4785, 6.02488 )

[sub_resource type="ParticlesMaterial" id=3]
[sub_resource type="ParticlesMaterial" id=4]
emission_shape = 2
emission_box_extents = Vector3( 20, 20, 0 )
direction = Vector3( 0, 0, 0 )
Expand All @@ -35,12 +36,15 @@ region_enabled = true
region_rect = Rect2( 541, 42, 58, 22 )

[node name="CollisionShape2D" parent="." index="1"]
shape = SubResource( 2 )
shape = SubResource( 3 )

[node name="Particles2D" type="Particles2D" parent="." index="4"]
visible = false
rotation = -1.5708
amount = 3
lifetime = 2.0
speed_scale = 5.0
process_material = SubResource( 3 )
process_material = SubResource( 4 )

[node name="Trail" parent="." index="5" instance=ExtResource( 4 )]
_length = 15
48 changes: 37 additions & 11 deletions weapons/LightSaber.tscn
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
[gd_scene load_steps=7 format=2]
[gd_scene load_steps=9 format=2]

[ext_resource path="res://weapons/Weapon.tscn" type="PackedScene" id=1]
[ext_resource path="res://assets/allSprites_retina_rotated.png" type="Texture" id=2]
[ext_resource path="res://weapons/LightSaber.cs" type="Script" id=3]
[ext_resource path="res://effects/Trail.cs" type="Script" id=4]

[sub_resource type="CanvasItemMaterial" id=1]
blend_mode = 1

[sub_resource type="Gradient" id=4]
colors = PoolColorArray( 0.87451, 0.87451, 0.87451, 0.470588, 0.617676, 0.988281, 0.988281, 0.792157 )

[sub_resource type="Animation" id=2]
resource_name = "Attack"
length = 0.25
length = 0.35
step = 0.01
tracks/0/type = "value"
tracks/0/path = NodePath("Handler:rotation_degrees")
Expand All @@ -18,10 +22,10 @@ tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"times": PoolRealArray( 0, 0.1, 0.24, 0.25 ),
"transitions": PoolRealArray( 1, 1, 1, 1 ),
"times": PoolRealArray( 0, 0.25, 0.35 ),
"transitions": PoolRealArray( 1, 1, 1 ),
"update": 0,
"values": [ 0.0, -100.0, 30.0, 0.0 ]
"values": [ 0.0, -100.0, 5.0 ]
}
tracks/1/type = "value"
tracks/1/path = NodePath("Area2D/CollisionShape2D:disabled")
Expand All @@ -30,10 +34,22 @@ tracks/1/loop_wrap = true
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/keys = {
"times": PoolRealArray( 0, 0.08, 0.23 ),
"times": PoolRealArray( 0, 0.25, 0.34, 0.35 ),
"transitions": PoolRealArray( 1, 1, 1, 1 ),
"update": 1,
"values": [ true, false, false, true ]
}
tracks/2/type = "value"
tracks/2/path = NodePath("Handler/Laser/Node/Line:visible")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/keys = {
"times": PoolRealArray( 0, 0.25, 0.35 ),
"transitions": PoolRealArray( 1, 1, 1 ),
"update": 1,
"values": [ true, false, true ]
"values": [ false, true, false ]
}

[sub_resource type="RectangleShape2D" id=3]
Expand All @@ -44,22 +60,32 @@ script = ExtResource( 3 )
CurrentWeaponType = 4
ItemResourceID = "SYC-200"
MaxAmmo = 0
CooldownTime = 1.0
CooldownTime = 3.0
ReloadTime = 1.0

[node name="Handler" type="Sprite" parent="." index="3"]
rotation = 0.0872665
texture = ExtResource( 2 )
region_enabled = true
region_rect = Rect2( 410, 3, 28, 17 )

[node name="Laser" type="Sprite" parent="Handler" index="0"]
self_modulate = Color( 68.21, 1, 1, 1 )
self_modulate = Color( 0, 36.05, 15.03, 1 )
material = SubResource( 1 )
position = Vector2( 90, 0 )
scale = Vector2( 3, 1 )
scale = Vector2( 4.184, 1 )
texture = ExtResource( 2 )
region_enabled = true
region_rect = Rect2( 438, 4, 51, 16 )
region_rect = Rect2( 560, 45, 35, 15 )

[node name="Node" type="Node" parent="Handler/Laser" index="0"]
script = ExtResource( 4 )
_width = 180.0

[node name="Line" type="Line2D" parent="Handler/Laser/Node" index="0"]
visible = false
width = 180.0
gradient = SubResource( 4 )

[node name="AnimationPlayer" type="AnimationPlayer" parent="." index="4"]
anims/Attack = SubResource( 2 )
Expand Down
2 changes: 1 addition & 1 deletion weapons/Rifile.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ script = ExtResource( 2 )
KnockbackForce = 10.0
ItemResourceID = "SYC-800"
MaxAmmo = 50
CooldownTime = 0.125
CooldownTime = 0.15
ReloadTime = 2.0
Bullet = ExtResource( 4 )

Expand Down

0 comments on commit 610552b

Please sign in to comment.