I have this push floor I'm making:

and I want the red arrow on it to move to the left and constantly repeat. I can draw it manually if I have to, but that's a giant pain in the butt so I'd Iike to know if it's possible to do through code or the inspector instead.
if this has been answered somewhere before I could not find it, everything I tried kept leading back to animatedtexture which is for using a texture to make animations... not for animating a texture. even a simple "that's not possible" would help me out here.

  • Actually there is a simple dirty (elegant?) solution for this without shaders.

    • So I use sprite2d for this, and maybe any node that can have textures and regions will work too.
    • In the inspector, after assigning the texture, enable region, and using edit region, select the whole thing.
    • Still in the inspector, under CanvasItem under texture, set Repeat to be Enabled
    • Attach script to the sprite2d and use the following code:
    @export var speed:= 32 # Modify it until satisfactory
    func _physics_process(delta: float) -> void:
    	region_rect.position.x += speed * delta 
    • I am speculating here, but this might be inefficient if there where a large amount of such tiles.
    • I used this to "scroll" a repetitive background , so used it only once.
      I hope this helps though.

soundgnome if my only other option is the dive down the rabbit hole that is writing my own shader, it'd take less time (for me at least) to just redraw every frame manually. thanks for the option but I'm gonna keep this open with the hopes that some other simpler solution is produced

Actually there is a simple dirty (elegant?) solution for this without shaders.

  • So I use sprite2d for this, and maybe any node that can have textures and regions will work too.
  • In the inspector, after assigning the texture, enable region, and using edit region, select the whole thing.
  • Still in the inspector, under CanvasItem under texture, set Repeat to be Enabled
  • Attach script to the sprite2d and use the following code:
@export var speed:= 32 # Modify it until satisfactory
func _physics_process(delta: float) -> void:
	region_rect.position.x += speed * delta 
  • I am speculating here, but this might be inefficient if there where a large amount of such tiles.
  • I used this to "scroll" a repetitive background , so used it only once.
    I hope this helps though.

    BroTa that feels kinda hacky, but it works perfectly. I don't foresee ever using maybe more than twenty on screen at once, and that's in an extreme case, so this should be fine.

    I wouldn't even call it hacky, it's taking advantage of texture map tiling which has been standard in GPUs for decades.

      synthnostate having to do like five things in the editor (most of which I've never had to use before for /anything/ ) before I can finally do it through code is what makes it feel hacky. not that it actually is hacky, it just feels that way.

        samuraidan I think you CAN do it all through code, and you should if you need to do it more than a few times. I do that a lot with UI controls - prototype in the editor, then write code to generate a bunch of controls in _ready() or whatever.