class_name Candle
extends BaseMob

onready var body: Sprite = $Body
onready var respawn_point = $RespawnPoint
onready var timer = $Timer
export var respawn_x: int = 48
export var respawn_y: int = 0
export var respawn2_x: int = 0
export var respawn2_y: int = 0
var burning: bool = false
var time = 0.0
var frame = 0

func _ready():
	lives = 99999
	respawn_point.set_position(Vector2(respawn_x, respawn_y))
	#respawn_point.move_local_x(respawn_x)
	#respawn_point.move_local_y(respawn_y)

func strike():
	timer.start()
	frame = 1
	$AudioStreamPlayer2D.play()
	
func next_frame():
	frame += 1
	if frame > 6:
		frame = 1
	var rect = body.get_region_rect()
	rect.position.x = frame * 32
	body.set_region_rect(rect)

func _reprogram(_body):
	respawn_point.set_position(Vector2(respawn2_x, respawn2_y))
