Skip to content

Commit

Permalink
Merge pull request #223 from NancokPS2/dead-coll
Browse files Browse the repository at this point in the history
Disables collisions for dead enemies
  • Loading branch information
jonathaneeckhout authored Jan 14, 2024
2 parents 1229354 + 1e81ca6 commit 5dc42bc
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions project.godot
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ locale/translations=PackedStringArray("res://assets/translation/en_US.en.transla
2d_physics/layer_5="Items"
2d_physics/layer_6="Networking"
2d_physics/layer_7="Projectiles"
2d_physics/layer_8="Passable Entity"

[rendering]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,10 @@ func _on_died():
animation_player.stop()
animation_player.play(die_animation)

if target_node is CollisionObject2D:
target_node.collision_layer = J.PHYSICS_LAYER_PASSABLE_ENTITIES
target_node.collision_mask = 0


func _on_respawned():
dead = false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ func _ready():
func _on_died():
despawn_timer.start()

if target_node is CollisionObject2D:
target_node.collision_layer = J.PHYSICS_LAYER_PASSABLE_ENTITIES
target_node.collision_mask = 0


func _on_despawn_timer_timeout():
if should_respawn:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ func _ready():
+ J.PHYSICS_LAYER_ENEMIES
+ J.PHYSICS_LAYER_NPCS
+ J.PHYSICS_LAYER_ITEMS
+ J.PHYSICS_LAYER_PASSABLE_ENTITIES
)
body_network_view_area.add_child(cs_body_network_view_area)

Expand Down
1 change: 1 addition & 0 deletions scripts/singletons/jdungeon.gd
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ const PHYSICS_LAYER_NPCS = 8
const PHYSICS_LAYER_ITEMS = 16
const PHYSICS_LAYER_NETWORKING = 32
const PHYSICS_LAYER_PROJECTILE = 64
const PHYSICS_LAYER_PASSABLE_ENTITIES = 128

const ARRIVAL_DISTANCE = 8
const DROP_RANGE = 64
Expand Down

0 comments on commit 5dc42bc

Please sign in to comment.