virus deals damage and takes double damage while spawning
This commit is contained in:
@@ -65,10 +65,16 @@ func set_spawned():
|
||||
|
||||
func take_hit(damage, knockback_vector, knockback_strength = 1):
|
||||
$HitSFX.play();
|
||||
health -= damage
|
||||
if self.spawning_state == SpawningState.Spawning:
|
||||
health -= damage * 2
|
||||
else:
|
||||
health -= damage
|
||||
if health <= 0:
|
||||
queue_free()
|
||||
elif knockback_strength > 0:
|
||||
knockback = -knockback_vector;
|
||||
knockback_timer.start(0.2 * knockback_strength);
|
||||
# Flash white?
|
||||
|
||||
func _on_body_entered(body: Node2D) -> void:
|
||||
body.take_hit(1, self.position.direction_to(body.position) * 100, 2)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
[gd_scene load_steps=30 format=3 uid="uid://bsv3h2lpv7h77"]
|
||||
[gd_scene load_steps=31 format=3 uid="uid://bsv3h2lpv7h77"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://bwhxwf77egesx" path="res://virus.gd" id="1_5nuwd"]
|
||||
[ext_resource type="Texture2D" uid="uid://mbey3bjcno10" path="res://assets/animations/Enemy_1_MERGED/Grow 1.png" id="2_2g5hr"]
|
||||
@@ -227,8 +227,11 @@ animations = [{
|
||||
"speed": 5.0
|
||||
}]
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_ifgnm"]
|
||||
size = Vector2(128, 128)
|
||||
[sub_resource type="CircleShape2D" id="CircleShape2D_ob56v"]
|
||||
radius = 85.0
|
||||
|
||||
[sub_resource type="CircleShape2D" id="CircleShape2D_lk7jo"]
|
||||
radius = 120.0
|
||||
|
||||
[node name="Virus" type="Node2D"]
|
||||
position = Vector2(0, -1)
|
||||
@@ -261,4 +264,11 @@ collision_layer = 31
|
||||
collision_mask = 31
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D"]
|
||||
shape = SubResource("RectangleShape2D_ifgnm")
|
||||
shape = SubResource("CircleShape2D_ob56v")
|
||||
|
||||
[node name="Hurtbox" type="Area2D" parent="."]
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="Hurtbox"]
|
||||
shape = SubResource("CircleShape2D_lk7jo")
|
||||
|
||||
[connection signal="body_entered" from="Area2D" to="." method="_on_body_entered"]
|
||||
|
||||
Reference in New Issue
Block a user