testproject/npc/sprite_2d.gd

28 lines
583 B
GDScript

extends Sprite2D
enum Nations {
ru = 0,
arab = 1,
chi = 2,
max,
}
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
pass # Replace with function body.
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
pass
func set_spacesuit(suit: bool) -> void:
var atlas: AtlasTexture = texture
if suit: atlas.region.position.y = 0
else: atlas.region.position.y = 16
func set_nation(nation: Nations) -> void:
var atlas: AtlasTexture = texture
atlas.region.position.x = 16*nation