From d9a6b8d03a29bd17857f371980c2303f8cf1c1c1 Mon Sep 17 00:00:00 2001 From: Danil Ko Date: Sat, 29 May 2021 19:56:16 -0700 Subject: [PATCH] https://github.com/danilko/topdown-2d-multiplayer/issues/12: Update initial explosion code --- agents/Agent.tscn | 16 ++++++++++------ effects/Trail.tscn | 14 +++++++------- map/GameWorld.tscn | 6 +++++- map/SimulateGameWorld.tscn | 5 +++++ projectiles/LaserRay.cs | 7 ++++--- projectiles/LaserRay.tscn | 4 ++-- projectiles/RifileBullet.tscn | 23 +++++++---------------- weapons/LaserGun.tscn | 6 +++--- weapons/LightSaber.tscn | 4 ++-- weapons/Shield.tscn | 6 +++--- 10 files changed, 48 insertions(+), 43 deletions(-) diff --git a/agents/Agent.tscn b/agents/Agent.tscn index 29bdacc..0e85bc9 100644 --- a/agents/Agent.tscn +++ b/agents/Agent.tscn @@ -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 ) @@ -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 diff --git a/effects/Trail.tscn b/effects/Trail.tscn index 9caf0fa..aa4fab4 100644 --- a/effects/Trail.tscn +++ b/effects/Trail.tscn @@ -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 diff --git a/map/GameWorld.tscn b/map/GameWorld.tscn index 920c51a..5d4bc50 100644 --- a/map/GameWorld.tscn +++ b/map/GameWorld.tscn @@ -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"] diff --git a/map/SimulateGameWorld.tscn b/map/SimulateGameWorld.tscn index 6fe60c4..1d6f3ab 100644 --- a/map/SimulateGameWorld.tscn +++ b/map/SimulateGameWorld.tscn @@ -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 ) @@ -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"] diff --git a/projectiles/LaserRay.cs b/projectiles/LaserRay.cs index 01fa454..7dc4505 100644 --- a/projectiles/LaserRay.cs +++ b/projectiles/LaserRay.cs @@ -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) @@ -107,6 +107,7 @@ public bool getIsCasting() { return isCasting; } + public void setIsCasting(bool isCasting) { this.isCasting = isCasting; @@ -132,7 +133,7 @@ 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(); } @@ -140,7 +141,7 @@ public void appear() 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(); } diff --git a/projectiles/LaserRay.tscn b/projectiles/LaserRay.tscn index af33f5c..b8a6d32 100644 --- a/projectiles/LaserRay.tscn +++ b/projectiles/LaserRay.tscn @@ -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 @@ -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="."] diff --git a/projectiles/RifileBullet.tscn b/projectiles/RifileBullet.tscn index 0baf2fd..1abf461 100644 --- a/projectiles/RifileBullet.tscn +++ b/projectiles/RifileBullet.tscn @@ -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 ) @@ -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 ) @@ -34,9 +33,6 @@ 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 @@ -44,10 +40,12 @@ 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 @@ -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 ) diff --git a/weapons/LaserGun.tscn b/weapons/LaserGun.tscn index 05b4a9e..69568ec 100644 --- a/weapons/LaserGun.tscn +++ b/weapons/LaserGun.tscn @@ -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 ) @@ -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 diff --git a/weapons/LightSaber.tscn b/weapons/LightSaber.tscn index 1fe82d4..44e0004 100644 --- a/weapons/LightSaber.tscn +++ b/weapons/LightSaber.tscn @@ -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 ) diff --git a/weapons/Shield.tscn b/weapons/Shield.tscn index a96a189..eb1727f 100644 --- a/weapons/Shield.tscn +++ b/weapons/Shield.tscn @@ -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"] @@ -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 )