Skip to content

Texturen dynamisch ändern

SamToorchi edited this page Feb 10, 2020 · 1 revision
entity.gd
var texture_default = null
var texture_hurt = null

func _ready():
	texture_default = $Sprite.texture
	texture_hurt = load($Sprite.texture.get_path().replace(".png", "_hurt.png"))

func damage_loop():
	# kleine zeitliche Puffer, bis Hitstun wieder auf 0 ist
	if hitstun > 0:
		hitstun -= 1
		$Sprite.texture = texture_hurt
	else: 
		$Sprite.texture = texture_default
Clone this wiki locally