i am creating a scrolling book and all sprites are pages …does array can contain sprites through which i can scroll and show current one and go back and forth
An array can contain anything. So you can hold all the sprites in an array and keep an index pointing at the current sprite.
var sprites = [sprite1, sprite2, sprite3] var current_sprite = 0 func move_next(): current_sprite = min(current_sprite + 1, sprites.size() - 1) return sprites[current_sprite] func move_prev(): current_sprite = max(current_sprite - 1, 0) return sprites[current_sprite]