extends Sprite

class_name Flatfish

const s = preload('res://images/game1/flatfish_s.tres')
const s_h = preload('res://images/game1/flatfish_s_h.tres')
const t = preload('res://images/game1/flatfish_t.tres')
const t_h = preload('res://images/game1/flatfish_t_h.tres')

var appeared = false
var half_rotation = false

func _init():
	update_texture()
	
func update_texture():
	if appeared:
		if half_rotation:
			texture = t
		else:
			texture = s
	else:
		if half_rotation:
			texture = t_h
		else:
			texture = s_h
	
func appear():
	appeared = true
	update_texture()
	
func do_rotation():
	half_rotation = !half_rotation
	if half_rotation:
		rotation_degrees += 90
	update_texture()
	
func disappear():
	appeared = false
	update_texture()
