This repository has been archived on 2025-09-12. You can view files and clone it, but cannot push or open issues or pull requests.
ld48/environment/Breakable.gd

18 lines
509 B
GDScript

extends StaticBody2D
var health: float = 100.0
export var resist_base: float = 0.00
export var resist_fire: float = 0.00
export var resist_ice: float = 0.00
export var resist_wind: float = 0.00
onready var home = self.position
func take_damage(dmg: float, fire_dmg: float, ice_dmg: float, wind_dmg: float):
health -= (1.0 - resist_base) * dmg
health -= (1.0 - resist_fire) * fire_dmg
health -= (1.0 - resist_ice) * ice_dmg
health -= (1.0 - resist_wind) * wind_dmg
if health <= 0.0:
queue_free()