neighbor-game/scripts/decor.gd

16 lines
521 B
GDScript3
Raw Normal View History

extends Node2D
onready var sprite := $Sprite
const SpriteAsset = {bush1 = "bush1", bush2 = "bush2", tree = "tree", lamppost = "lamppost", stopsign = "stopsign"}
export var SPRITE_ASSET := SpriteAsset.tree
func _ready() -> void:
if SPRITE_ASSET in SpriteAsset:
2022-08-04 20:11:25 -06:00
sprite.texture = load("res://assets/%s.png" % SPRITE_ASSET)
else:
print("ERROR - Provided Sprite asset is either not defined or misspelled: %s FIXME %s" % [SPRITE_ASSET, self.name])
2022-08-04 20:11:25 -06:00
sprite.texture = load("res://assets/%s.png" % SpriteAsset.bush1)