Skip to content

Commit

Permalink
#12: Update initial explosion code
Browse files Browse the repository at this point in the history
  • Loading branch information
Danil Ko committed May 30, 2021
1 parent 0fbe700 commit d9a6b8d
Show file tree
Hide file tree
Showing 10 changed files with 48 additions and 43 deletions.
16 changes: 10 additions & 6 deletions agents/Agent.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -98,13 +98,15 @@ region_rect = Rect2( 0, 263, 95, 94 )

[node name="BoosterTrail" parent="RightBooster" instance=ExtResource( 6 )]
material = SubResource( 1 )
position = Vector2( 50, 0 )
position = Vector2( 200, 0 )
amount = 10
lifetime = 0.8
speed_scale = 2.0
explosiveness = 0.2
randomness = 1.0

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

[node name="LeftBooster" type="Sprite" parent="."]
position = Vector2( -31.395, -39.063 )
Expand All @@ -116,13 +118,15 @@ region_rect = Rect2( 0, 263, 95, 94 )

[node name="BoosterTrail" parent="LeftBooster" instance=ExtResource( 6 )]
material = SubResource( 2 )
position = Vector2( 50, 0 )
position = Vector2( 200, 0 )
amount = 10
lifetime = 0.8
speed_scale = 2.0
explosiveness = 0.2
randomness = 1.0

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

[node name="Explosion" parent="." instance=ExtResource( 2 )]
visible = false
Expand Down
14 changes: 7 additions & 7 deletions effects/Trail.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,22 @@

[ext_resource path="res://effects/Trail.cs" type="Script" id=1]

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

[sub_resource type="Curve" id=1]
[sub_resource type="Curve" id=2]
_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]
[sub_resource type="Gradient" id=3]
offsets = PoolRealArray( 0.00460829, 1 )
colors = PoolColorArray( 1, 0.964706, 0.952941, 0.215686, 53.18, 11.5096, 0.369998, 0.54 )
colors = PoolColorArray( 1, 0.964706, 0.952941, 0.215686, 2, 1, 0.49, 0.36 )

[node name="Trail" type="Node"]
script = ExtResource( 1 )

[node name="Line" type="Line2D" parent="."]
show_behind_parent = true
material = SubResource( 3 )
width_curve = SubResource( 1 )
gradient = SubResource( 2 )
material = SubResource( 1 )
width_curve = SubResource( 2 )
gradient = SubResource( 3 )
joint_mode = 2
6 changes: 5 additions & 1 deletion map/GameWorld.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,13 @@ gradient = SubResource( 1 )
[sub_resource type="Environment" id=3]
background_mode = 4
glow_enabled = true
glow_levels/1 = true
glow_levels/2 = true
glow_levels/4 = true
glow_intensity = 1.5
glow_bloom = 0.1
glow_hdr_threshold = 0.5
glow_blend_mode = 1
glow_hdr_threshold = 0.9
adjustment_color_correction = SubResource( 2 )

[node name="Map" type="Node2D"]
Expand Down
5 changes: 5 additions & 0 deletions map/SimulateGameWorld.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@
[sub_resource type="Environment" id=1]
background_mode = 4
glow_enabled = true
glow_levels/1 = true
glow_levels/2 = true
glow_levels/4 = true
glow_intensity = 1.0
glow_blend_mode = 1

[node name="Map" type="Node2D"]
script = ExtResource( 3 )
Expand Down Expand Up @@ -70,6 +74,7 @@ wait_time = 2.0
autostart = true

[node name="GameCamera" parent="." instance=ExtResource( 9 )]
zoom = Vector2( 4, 4 )

[node name="InventoryManager" parent="." instance=ExtResource( 5 )]
[connection signal="timeout" from="ChangeAgentBehavior" to="." method="_changeAgentBehavior"]
7 changes: 4 additions & 3 deletions projectiles/LaserRay.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public override void _PhysicsProcess(float delta)
line2DLaser.Points = newPoints;

particles2DBeam.Position = castPoint * 0.5f;
particles2DBeam.ProcessMaterial.Set("emission_box_extents", new Vector3(castPoint.x, 20.0f, 0.0f));
particles2DBeam.ProcessMaterial.Set("emission_box_extents", new Vector3(castPoint.x, 5.0f, 0.0f));
}

public void Initialize(GameWorld gameWorld, Agent sourceAgent, Team sourceTeam)
Expand All @@ -107,6 +107,7 @@ public bool getIsCasting()
{
return isCasting;
}

public void setIsCasting(bool isCasting)
{
this.isCasting = isCasting;
Expand All @@ -132,15 +133,15 @@ public void setIsCasting(bool isCasting)
public void appear()
{
tween.StopAll();
tween.InterpolateProperty(line2DLaser, "width", 0.0f, 20.0f, 0.2f);
tween.InterpolateProperty(line2DLaser, "width", 0.0f, 5.0f, 0.2f);
tween.Start();
}


public void disappear()
{
tween.StopAll();
tween.InterpolateProperty(line2DLaser, "width", 20.0f, 0.0f, 0.1f);
tween.InterpolateProperty(line2DLaser, "width", 5.0f, 0.0f, 0.1f);
tween.Start();
}

Expand Down
4 changes: 2 additions & 2 deletions projectiles/LaserRay.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ direction = Vector3( 0, 0, 0 )
gravity = Vector3( 0, 0, 0 )
linear_accel = 10.0
scale = 0.5
color = Color( 0.5, 3, 6, 1 )
color = Color( 0.5, 1, 2, 1 )

[node name="LaserRay" type="RayCast2D"]
enabled = true
Expand All @@ -61,7 +61,7 @@ Damage = 60
material = SubResource( 1 )
points = PoolVector2Array( 0, 0, 100, 0 )
width = 0.0
default_color = Color( 10, 10, 10, 1 )
default_color = Color( 0.8, 1, 2, 1 )

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

Expand Down
23 changes: 7 additions & 16 deletions projectiles/RifileBullet.tscn
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
[gd_scene load_steps=13 format=2]
[gd_scene load_steps=11 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]
[ext_resource path="res://projectiles/Particle2DProjectile.tscn" type="PackedScene" id=5]
[ext_resource path="res://assets/shadow_circle.png" type="Texture" id=7]

[sub_resource type="RectangleShape2D" id=1]
extents = Vector2( 20.125, 7.75 )
Expand All @@ -15,7 +14,7 @@ blend_mode = 1
light_mode = 1

[sub_resource type="Gradient" id=3]
colors = PoolColorArray( 10, 10, 10, 1, 1, 1, 1, 0.25 )
colors = PoolColorArray( 2, 2, 2, 1, 1, 1, 1, 0.25 )

[sub_resource type="GradientTexture" id=4]
gradient = SubResource( 3 )
Expand All @@ -34,20 +33,19 @@ linear_accel = 100.0
scale = 10.0
color_ramp = SubResource( 4 )

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

[node name="RifileBullet" instance=ExtResource( 1 )]
script = ExtResource( 3 )
Speed = 4000
Damage = 10
Lifetime = 10.0

[node name="Sprite" parent="." index="0"]
self_modulate = Color( 10, 10, 10, 1 )
self_modulate = Color( 3, 2, 1, 1 )
rotation = 3.14159
scale = Vector2( 3, 0.5 )
texture = ExtResource( 2 )
region_enabled = true
region_rect = Rect2( 623, 200, 73, 34 )
region_rect = Rect2( 653, 41, 30, 24 )

[node name="ProjectileArea2D" parent="." index="3"]
visible = false
Expand All @@ -58,17 +56,10 @@ collision_mask = 4
shape = SubResource( 1 )

[node name="Trail" parent="." index="4" instance=ExtResource( 4 )]
_width = 8.0
_width = 5.0

[node name="Particle2DProjectile" parent="." index="5" instance=ExtResource( 5 )]
material = SubResource( 2 )
speed_scale = 2.0
process_material = SubResource( 5 )
texture = null

[node name="Sprite2" type="Sprite" parent="." index="6"]
self_modulate = Color( 2, 2, 2, 1 )
material = SubResource( 6 )
position = Vector2( 0, -0.132428 )
scale = Vector2( 1, 2 )
texture = ExtResource( 7 )
6 changes: 3 additions & 3 deletions weapons/LaserGun.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ script = ExtResource( 4 )
CurrentWeaponType = 1
KnockbackForce = 10.0
ItemResourceID = "SYC-1000"
MaxAmmo = 30
MaxAmmo = 10
CooldownTime = 0.5
ReloadTime = 5.0
ReloadTime = 10.0

[node name="TriggerPoint" parent="." index="1"]
position = Vector2( 120, 0 )
Expand All @@ -25,4 +25,4 @@ region_rect = Rect2( -1, 263, 96, 93 )

[node name="LaserRay" parent="." index="3" instance=ExtResource( 5 )]
position = Vector2( 120, 0 )
Damage = 30
Damage = 20
4 changes: 2 additions & 2 deletions weapons/LightSaber.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,10 @@ region_enabled = true
region_rect = Rect2( 410, 3, 28, 17 )

[node name="Laser" type="Sprite" parent="Handler" index="0"]
self_modulate = Color( 0, 10, 10, 1 )
self_modulate = Color( 0, 2, 2, 1 )
material = SubResource( 1 )
position = Vector2( 90, 0 )
scale = Vector2( 4.184, 1 )
scale = Vector2( 4.184, 0.368 )
texture = ExtResource( 2 )
region_enabled = true
region_rect = Rect2( 560, 45, 35, 15 )
Expand Down
6 changes: 3 additions & 3 deletions weapons/Shield.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ blend_mode = 1
script = ExtResource( 2 )
CurrentWeaponType = 3
ItemResourceID = "SYC-600"
MaxAmmo = 500
MaxAmmo = 100
Shot = 0
CooldownTime = 0.5
ReloadTime = 10.0
ReloadTime = 20.0
Damage = 1

[node name="Sprite" type="Sprite" parent="." index="3"]
Expand All @@ -25,7 +25,7 @@ region_enabled = true
region_rect = Rect2( 734, 365, 65, 116 )

[node name="Effect" type="Sprite" parent="." index="4"]
modulate = Color( 0.58, 5.23, 3.47, 1 )
modulate = Color( 0.58, 1.74, 2.31, 1 )
material = SubResource( 1 )
position = Vector2( 30, 0 )
scale = Vector2( 0.2, 6 )
Expand Down

0 comments on commit d9a6b8d

Please sign in to comment.