change sprite godot in code code example

Example: godot sprite tiling

Using A TextureRect

    Create a TextureRect-node
    Assign your image as its texture
    Set expand to true
    Set strech_mode to STRETCH_TILE / 2
    Set rect_size to the dimensions you wish for

Using A Sprite

    Select your image in the "FileSystem"-Tab
    Switch over to the "Import"-Tab (next to the "Scene"-Tab)
    Set "Repeat" to "Enabled" and click "Reimport" (at the bottom)
    Create a Sprite-node
    Assign your image as its texture
    Set region_enabled to true
    Set region_rect to the dimensions you wish for

Tags:

Go Example