PirateTreasureHunt/BackgroundWater.gd

25 lines
606 B
GDScript

extends Sprite
# Declare member variables here. Examples:
# var a = 2
# var b = "text"
export var world_offset = Vector2.ZERO
# Called when the node enters the scene tree for the first time.
func _ready():
pass # Replace with function body.
func _process(_delta):
region_rect.size = OS.get_window_safe_area().size
var time = OS.get_system_time_msecs()
var texture_size = texture.get_size()
var texture_offset = Vector2(
world_offset.x / texture_size.x,
world_offset.y / texture_size.y
)
print ("offset: ", texture_offset)
material.set_shader_param("uv_offset", texture_offset)
update()