I'm quite new to programming and GDScript and wondering how to do something that I did think would be quite simple, but I'm struggling a bit!
I've loaded an array of images and I want it to go through each of these images one after the other each time a button is clicked and replace a sprite texture with that particular image.
Right now I can successfully get the sprite to change to any of the images if I put its array number in e.g. newtexture or newtexture etc, but I would like it to go through each of the images one after the other every time the user clicks the button. (And once it's got to the last image, go back to the first image again)
What am I missing?
Here is the code:
onready var my_sprite = get_node("/root/Game/Picture/Sprite")
var new_texture = [
func _on_Arrow_pressed() -> void:
my_sprite.texture = new_texture
Thanks in advance for any help!