mirror of
https://github.com/godotengine/godot-demo-projects.git
synced 2026-01-04 23:10:08 +01:00
Fix bomb collisions through walls
This commit is contained in:
@@ -11,8 +11,12 @@ func explode():
|
||||
return
|
||||
for p in in_area:
|
||||
if p.has_method("exploded"):
|
||||
# Exploded has a master keyword, so it will only be received by the master.
|
||||
p.rpc("exploded", from_player)
|
||||
# Checks if there is wall in between bomb and the object
|
||||
var world_state = get_world_2d().direct_space_state
|
||||
var result = world_state.intersect_ray(position, p.position)
|
||||
if not result.collider is TileMap:
|
||||
# Exploded has a master keyword, so it will only be received by the master.
|
||||
p.rpc("exploded", from_player)
|
||||
|
||||
|
||||
func done():
|
||||
|
||||
Reference in New Issue
Block a user