ammo consistent between states, enemy will reload automatically if low but not depleted

This commit is contained in:
derek
2025-04-25 14:25:16 -05:00
parent 56ecad377e
commit f0ec7bc953
5 changed files with 38 additions and 11 deletions

View File

@@ -75,7 +75,7 @@ var can_die : bool = false
var knocked = false
var stunned = false
var health
var ammo
var point_of_interest
var character_follow
@@ -83,6 +83,7 @@ var player_last_seen
func _ready():
health = start_health
ammo = max_ammo
player = level_control.player
#health_bar_sprite.visible = false
turret_material.emission_enabled = false
@@ -130,6 +131,17 @@ func is_player_visible():
return false
func is_player_in_area():
if visibility_areas != null:
for area in visibility_areas:
var bodies = area.get_overlapping_bodies()
if bodies != null:
for i in bodies:
if i is Player:
return true
return false
func cache_player_pos():
if line_of_sight_ray.is_colliding():
if line_of_sight_ray.get_collider() is Player: