Flopsy/objects/characters/flake/flake.gd

21 lines
466 B
GDScript

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()
enum ANIMATION {
idle,
run
}
export(ANIMATION) var animation = 0
func _ready():
$Sprite.flip_h = reverse_direction
$Sprite.play(ANIMATION.keys()[animation])
func _on_player_entered(body):
if flake_scene != "":
main.load_level(flake_scene, true)