fixed roboturret turning when seeing blocks

This commit is contained in:
pennyrigate 2023-09-12 01:11:59 -04:00
parent 1c232945dc
commit 519670e0cd
2 changed files with 8 additions and 7 deletions

View file

@ -18,10 +18,11 @@ func _ready():
func _physics_process(delta): func _physics_process(delta):
if raycast.is_colliding(): if raycast.is_colliding():
if sign(shootpos.position.x) == -1: if raycast.get_collider().is_in_group("player_hitbox"):
anims.play("turn right") if sign(shootpos.position.x) == -1:
else: anims.play("turn right")
anims.play("turn left") else:
anims.play("turn left")
#Do not charge up offscreen #Do not charge up offscreen
if Game.get_sector(position) != Game.current_sector: timer.start() if Game.get_sector(position) != Game.current_sector: timer.start()

View file

@ -106,7 +106,7 @@ tracks/2/keys = {
} }
[sub_resource type="RectangleShape2D" id=5] [sub_resource type="RectangleShape2D" id=5]
extents = Vector2( 4, 4 ) extents = Vector2( 2, 3 )
[sub_resource type="Animation" id=6] [sub_resource type="Animation" id=6]
resource_name = "eye hue" resource_name = "eye hue"
@ -156,13 +156,13 @@ autostart = true
position = Vector2( 3, 3 ) position = Vector2( 3, 3 )
enabled = true enabled = true
cast_to = Vector2( 48, 0 ) cast_to = Vector2( 48, 0 )
collision_mask = 8 collision_mask = 10
collide_with_areas = true collide_with_areas = true
[node name="Hitbox" type="Area2D" parent="." groups=["enemy_hitbox"]] [node name="Hitbox" type="Area2D" parent="." groups=["enemy_hitbox"]]
[node name="CollisionShape2D" type="CollisionShape2D" parent="Hitbox"] [node name="CollisionShape2D" type="CollisionShape2D" parent="Hitbox"]
position = Vector2( 4, 4 ) position = Vector2( 3, 5 )
shape = SubResource( 5 ) shape = SubResource( 5 )
[node name="EyeAnim" type="AnimationPlayer" parent="."] [node name="EyeAnim" type="AnimationPlayer" parent="."]