Skip to content

Commit

Permalink
Move _on_hit_collider_body_entered logic to enemy.gd
Browse files Browse the repository at this point in the history
  • Loading branch information
konsumlamm committed Apr 15, 2024
1 parent 5b21c92 commit a3ba8de
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 11 deletions.
1 change: 1 addition & 0 deletions src/scenes/enemies/bookworm.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,7 @@ size = Vector2(11, 13)
[node name="Bookworm" instance=ExtResource("1_hki2g")]
script = ExtResource("2_rc7d1")
score = 30
ATTACK_DAMAGE = 0.0

[node name="AnimatedSprite2D" parent="." index="0"]
position = Vector2(1.5, -0.5)
Expand Down
2 changes: 1 addition & 1 deletion src/scripts/enemies/enemy.gd
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ func i_am_gonna_kill_myself():


func _on_hit_collider_body_entered(body):
pass # Replace with function body.
hit_player(body)

func _on_spike_collider_body_entered(body: Node2D) -> void:
if body is TileMap: colliding_spike = true
Expand Down
6 changes: 0 additions & 6 deletions src/scripts/enemies/firedevil.gd
Original file line number Diff line number Diff line change
@@ -1,7 +1 @@
extends Enemy

@onready var anim: AnimationPlayer = $AnimationPlayer
@onready var player: CharacterBody2D = get_tree().get_first_node_in_group("player")

func _on_hit_collider_body_entered(body):
hit_player(body)
4 changes: 0 additions & 4 deletions src/scripts/enemies/unicorn.gd
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,3 @@ func _physics_process(delta):

do_physics(delta)
move_and_slide()


func _on_hit_collider_body_entered(body):
hit_player(body)

0 comments on commit a3ba8de

Please sign in to comment.