Untitled
unknown
plain_text
a year ago
741 B
12
Indexable
extends RigidBody2D var players_touching = [] var damage_tick_cooldown = 1 func _on_area_2d_body_entered(body): if !self.players_touching.has(body) and body.is_in_group("players"): self.players_touching.append(body) func _on_area_2d_body_exited(body): self.players_touching.erase(body) func _physics_process(delta): if self.damage_tick_cooldown < 0: self.damage_tick_cooldown = 0 else: self.damage_tick_cooldown -= delta for body in self.players_touching: if self.damage_tick_cooldown < 0 and (Time.get_unix_time_from_system() - body.last_freeze_time > body.freeze_duration or body.freeze_position.distance_to(self.position) > body.freeze_radius): body.health -= 10 self.damage_tick_cooldown = 1
Editor is loading...
Leave a Comment