From 32ca5d2de21bc240e7aa6008f06066a2d31497f0 Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Tue, 5 Apr 2022 00:26:27 +0200 Subject: [PATCH] :boom: Smooth enemy damage --- src/entities/enemies/ChaserEnemy.gd | 2 +- src/entities/enemies/ChaserEnemy.tscn | 1 - src/levels/Music.gd | 12 +++---- src/levels/phaseone/PhaseOne.tscn | 47 ++++++++++++++++++++++++++- src/pickups/BigArrowPickup.tscn | 9 +++-- src/pickups/effects/BigArrow.tscn | 6 ++-- src/pickups/effects/RapidFire.gd | 1 - 7 files changed, 64 insertions(+), 14 deletions(-) diff --git a/src/entities/enemies/ChaserEnemy.gd b/src/entities/enemies/ChaserEnemy.gd index dc81db8..932d1fe 100644 --- a/src/entities/enemies/ChaserEnemy.gd +++ b/src/entities/enemies/ChaserEnemy.gd @@ -2,4 +2,4 @@ extends KinematicBody2D func _on_AttractedToMovement_collided(_origin, collision): - $Damaging.do_damage(collision.collider, 1) + $Damaging.do_damage(collision.collider, get_physics_process_delta_time()) diff --git a/src/entities/enemies/ChaserEnemy.tscn b/src/entities/enemies/ChaserEnemy.tscn index e8498e3..4e06797 100644 --- a/src/entities/enemies/ChaserEnemy.tscn +++ b/src/entities/enemies/ChaserEnemy.tscn @@ -64,7 +64,6 @@ loot_weights = [ 80.0, 10.0, 10.0 ] [node name="Damaging" type="Node" parent="." index="5"] script = ExtResource( 11 ) damage = -10.0 -destroy_after_damage = true [connection signal="collided" from="AttractedToMovement" to="." method="_on_AttractedToMovement_collided"] [connection signal="moved_in_direction" from="AttractedToMovement" to="Shape/FourSidedSprite" method="_on_AttractedToMovement_moved_in_direction"] diff --git a/src/levels/Music.gd b/src/levels/Music.gd index 87a33a0..ee76dd8 100644 --- a/src/levels/Music.gd +++ b/src/levels/Music.gd @@ -2,12 +2,12 @@ extends Node class_name Music -export var choir_min: float = 0.05 -export var choir_max: float = 0.30 -export var bell_min: float = 0.20 -export var bell_max: float = 0.60 -export var drum_min: float = 0.40 -export var drum_max: float = 0.80 +export var choir_min: float = 10 +export var choir_max: float = 60 +export var bell_min: float = 40 +export var bell_max: float = 100 +export var drum_min: float = 100 +export var drum_max: float = 160 export var muted: bool setget set_mute, get_mute diff --git a/src/levels/phaseone/PhaseOne.tscn b/src/levels/phaseone/PhaseOne.tscn index dc7880b..dfe495e 100644 --- a/src/levels/phaseone/PhaseOne.tscn +++ b/src/levels/phaseone/PhaseOne.tscn @@ -1,5 +1,6 @@ -[gd_scene load_steps=15 format=2] +[gd_scene load_steps=16 format=2] +[ext_resource path="res://src/pickups/BranchPickup.tscn" type="PackedScene" id=1] [ext_resource path="res://src/mechanics/GrassDirtTileset.png" type="Texture" id=2] [ext_resource path="res://src/entities/fire/Fire.tscn" type="PackedScene" id=3] [ext_resource path="res://src/behaviours/spawning/SpawnEveryPeriod.tscn" type="PackedScene" id=4] @@ -151,6 +152,46 @@ bounds = Vector2( 1280, 640 ) [node name="Pickups" type="Node" parent="Entities/Containers"] +[node name="BranchPickup" parent="Entities/Containers/Pickups" instance=ExtResource( 1 )] +position = Vector2( 594, 322 ) +scale = Vector2( 1, 1 ) + +[node name="Despawn" parent="Entities/Containers/Pickups/BranchPickup" index="2"] +autostart = false + +[node name="ChangeFireIntensity" parent="Entities/Containers/Pickups/BranchPickup" index="3"] +amount_per_second = 30.0 + +[node name="BranchPickup2" parent="Entities/Containers/Pickups" instance=ExtResource( 1 )] +position = Vector2( 675, 417 ) +scale = Vector2( 1, 1 ) + +[node name="Despawn" parent="Entities/Containers/Pickups/BranchPickup2" index="2"] +autostart = false + +[node name="ChangeFireIntensity" parent="Entities/Containers/Pickups/BranchPickup2" index="3"] +amount_per_second = 30.0 + +[node name="BranchPickup3" parent="Entities/Containers/Pickups" instance=ExtResource( 1 )] +position = Vector2( 742, 115 ) +scale = Vector2( 1, 1 ) + +[node name="Despawn" parent="Entities/Containers/Pickups/BranchPickup3" index="2"] +autostart = false + +[node name="ChangeFireIntensity" parent="Entities/Containers/Pickups/BranchPickup3" index="3"] +amount_per_second = 30.0 + +[node name="BranchPickup4" parent="Entities/Containers/Pickups" instance=ExtResource( 1 )] +position = Vector2( 325, 135 ) +scale = Vector2( 1, 1 ) + +[node name="Despawn" parent="Entities/Containers/Pickups/BranchPickup4" index="2"] +autostart = false + +[node name="ChangeFireIntensity" parent="Entities/Containers/Pickups/BranchPickup4" index="3"] +amount_per_second = 30.0 + [connection signal="spawned" from="Entities/Containers/Enemies/TowardsFireSpawner/SpawnEveryPeriod" to="Entities/Containers/Enemies/TowardsFireSpawner/SpawnEveryPeriod/SetSpawnedGoalTo" method="_on_SpawnEveryPeriod_spawned"] [connection signal="spawned" from="Entities/Containers/Enemies/TowardsFireSpawner/SpawnEveryPeriod" to="Entities/Containers/Enemies/TowardsFireSpawner/TeleportToScreenEdge" method="_on_SpawnEveryPeriod_spawned"] [connection signal="spawned" from="Entities/Containers/Enemies/TowardsFireSpawner2/SpawnEveryPeriod" to="Entities/Containers/Enemies/TowardsFireSpawner2/SpawnEveryPeriod/SetSpawnedGoalTo" method="_on_SpawnEveryPeriod_spawned"] @@ -164,3 +205,7 @@ bounds = Vector2( 1280, 640 ) [editable path="Entities/Containers/Enemies/TowardsFireSpawner2/SpawnEveryPeriod"] [editable path="Entities/Containers/Enemies/TowardsFireSpawner3/SpawnEveryPeriod"] [editable path="Entities/Containers/Enemies/TowardsPlayerSpawner/SpawnEveryPeriod"] +[editable path="Entities/Containers/Pickups/BranchPickup"] +[editable path="Entities/Containers/Pickups/BranchPickup2"] +[editable path="Entities/Containers/Pickups/BranchPickup3"] +[editable path="Entities/Containers/Pickups/BranchPickup4"] diff --git a/src/pickups/BigArrowPickup.tscn b/src/pickups/BigArrowPickup.tscn index e4041f5..b02af7d 100644 --- a/src/pickups/BigArrowPickup.tscn +++ b/src/pickups/BigArrowPickup.tscn @@ -1,9 +1,10 @@ -[gd_scene load_steps=3 format=2] +[gd_scene load_steps=4 format=2] [ext_resource path="res://src/pickups/Pickup.tscn" type="PackedScene" id=1] [ext_resource path="res://src/entities/bullets/PiercingArrow.png" type="Texture" id=2] +[ext_resource path="res://src/pickups/effects/BigArrow.tscn" type="PackedScene" id=3] -[node name="BranchPickup" instance=ExtResource( 1 )] +[node name="BigArrowPickup" instance=ExtResource( 1 )] scale = Vector2( 0.5, 0.5 ) [node name="Sprite" parent="Shape" index="0"] @@ -14,3 +15,7 @@ texture = ExtResource( 2 ) [node name="Despawn" parent="." index="2"] wait_time = 10.0 autostart = true + +[node name="BigArrow" parent="." index="3" instance=ExtResource( 3 )] + +[connection signal="picked_up" from="." to="BigArrow" method="_on_picked_up"] diff --git a/src/pickups/effects/BigArrow.tscn b/src/pickups/effects/BigArrow.tscn index b34161a..2d3160e 100644 --- a/src/pickups/effects/BigArrow.tscn +++ b/src/pickups/effects/BigArrow.tscn @@ -1,6 +1,8 @@ -[gd_scene load_steps=2 format=2] +[gd_scene load_steps=3 format=2] -[ext_resource path="res://src/pickups/effects/RapidFire.gd" type="Script" id=1] +[ext_resource path="res://src/pickups/effects/BigArrow.gd" type="Script" id=1] +[ext_resource path="res://src/entities/bullets/PiercingArrow.tscn" type="PackedScene" id=2] [node name="BigArrow" type="Node"] script = ExtResource( 1 ) +new_spawning = ExtResource( 2 ) diff --git a/src/pickups/effects/RapidFire.gd b/src/pickups/effects/RapidFire.gd index b06170e..3a145a9 100644 --- a/src/pickups/effects/RapidFire.gd +++ b/src/pickups/effects/RapidFire.gd @@ -17,4 +17,3 @@ func _on_picked_up(): func _on_expired(): target_click.rapid_fire_instances -= 1 target_cooldown.wait_time *= 2 -