Flopsy/objects/characters/flake/flake.gd

22 lines
466 B
GDScript3
Raw Normal View History

2022-07-17 14:24:15 +02:00
extends "res://objects/characters/character.gd"
export var reverse_direction: bool = false
export(String, FILE, "*.tscn") var flake_scene
onready var level = get_parent()
onready var main = level.get_parent()
2022-07-20 04:28:30 +02:00
enum ANIMATION {
idle,
run
}
export(ANIMATION) var animation = 0
2022-07-17 14:24:15 +02:00
func _ready():
$Sprite.flip_h = reverse_direction
2022-07-20 04:28:30 +02:00
$Sprite.play(ANIMATION.keys()[animation])
2022-07-17 14:24:15 +02:00
func _on_player_entered(body):
2022-07-20 04:28:30 +02:00
if flake_scene != "":
main.load_level(flake_scene, true)