cops only shoot characters on the same screen as them (fixes issue #79)
This commit is contained in:
parent
3e51a5062f
commit
8ac962d855
1 changed files with 24 additions and 23 deletions
|
@ -44,6 +44,7 @@ func _physics_process(delta):
|
||||||
# check for player in raycast
|
# check for player in raycast
|
||||||
var collider = shoot_cast.get_collider()
|
var collider = shoot_cast.get_collider()
|
||||||
if collider != null && (collider.is_in_group("player") or collider.is_in_group("msx")):
|
if collider != null && (collider.is_in_group("player") or collider.is_in_group("msx")):
|
||||||
|
if Game.get_sector(global_position) == Game.get_sector(collider.global_position):
|
||||||
# kill player and enter shooting state temporarily
|
# kill player and enter shooting state temporarily
|
||||||
collider.get_parent().die()
|
collider.get_parent().die()
|
||||||
# play sound
|
# play sound
|
||||||
|
@ -61,8 +62,8 @@ func _physics_process(delta):
|
||||||
# set line point to point of collision
|
# set line point to point of collision
|
||||||
var hit_x = shoot_line.to_local(hit_position).x
|
var hit_x = shoot_line.to_local(hit_position).x
|
||||||
shoot_line.points[1].x = hit_x
|
shoot_line.points[1].x = hit_x
|
||||||
# shoot_line.visible = true
|
# shoot_line.visible = true
|
||||||
# get_tree().create_timer(0.05, false).connect("timeout", shoot_line, "set_visible", [false], CONNECT_DEFERRED)
|
# get_tree().create_timer(0.05, false).connect("timeout", shoot_line, "set_visible", [false], CONNECT_DEFERRED)
|
||||||
# move and play sparks
|
# move and play sparks
|
||||||
sparks.global_position = hit_position
|
sparks.global_position = hit_position
|
||||||
sparks.emitting = true
|
sparks.emitting = true
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue