initial
This commit is contained in:
36
ego/Ego.gd
Normal file
36
ego/Ego.gd
Normal file
@@ -0,0 +1,36 @@
|
||||
extends Node2D
|
||||
|
||||
|
||||
# Declare member variables here. Examples:
|
||||
# var a = 2
|
||||
# var b = "text"
|
||||
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready():
|
||||
pass # Replace with function body.
|
||||
|
||||
@export var facing = "S"
|
||||
|
||||
func play_animation(anim, seek):
|
||||
$AnimatedSprite2D.play(anim + "_" + facing)
|
||||
$AnimatedSprite2D.frame = seek
|
||||
func play_animation_raw(anim):
|
||||
$AnimatedSprite2D.play(anim)
|
||||
|
||||
func play_animation_maintain(anim):
|
||||
|
||||
var i = $AnimatedSprite2D.frame
|
||||
|
||||
if anim + "_" + facing != $AnimatedSprite2D.animation:
|
||||
#print (anim, i)
|
||||
$AnimatedSprite2D.stop()
|
||||
$AnimatedSprite2D.play(anim + "_" + facing)
|
||||
$AnimatedSprite2D.frame = i
|
||||
elif !$AnimatedSprite2D.is_playing():
|
||||
$AnimatedSprite2D.play(anim + "_" + facing)
|
||||
$AnimatedSprite2D.frame = 0
|
||||
|
||||
func stop_animation():
|
||||
$AnimatedSprite2D.frame = 0
|
||||
$AnimatedSprite2D.stop()
|
||||
Reference in New Issue
Block a user