extends Node2D

onready var texture : TextureRect = $TextureRect

var force_stop = false
var moving = false

func _ready():
	stop()

func stop():
	moving = false
	force_stop = true
	texture.material.set_shader_param("scroll_speed", 0)

func start():
	moving = true
	force_stop = false
	texture.material.set_shader_param("scroll_speed", 0.2)

func _process(delta):
	if not force_stop:
		if get_tree().paused and moving:
			stop()
			force_stop = false
		elif not get_tree().paused and not moving:
			start()
