Reference Created Sprite by ID

My goal was to create 25 sprites, in 5 groups.
So I created a function to loop the creation of a sprite 5 times. I have 5 sprites, looped 5 times = 25.

Now how to control them afterwards? I saved the Component ID as a variable and as you can see in the picture, used that varible. It works! Obviouly only the last created sprite did anything but it proved that Component ID is usable.

Good enough for me. On to the next challenge.

Use the list of sprites to access what you need

Like this?

I know that I created 5, so there will be 5 in the list, how do I control an individual one?

To get a sprite from the list, use a special block to get an option at the specified index.

1 Like

Worked like a charm! Thanks all, learning new skills everyday!

Hi there,
I want to, use this feature, but the list is a vatiable, and thats does not seem to work.
I set the variable like this:
and want to use it like this:

The sprite (which should be “Schijf1” - and it reads that way), but it doesn’t move.
When I use the name of the Sprite directly, it works fine.

Please help!
Thanks in advance and a very Thunkable new year!!

Here is a link to the app I am building:

The aim is “the towers of Hanoi”, a mathematical/logical game

I am a teacher and need the game to work as an example for my students
Many thanks in advance.

Remove the “app variable block” right before the “join” block. Your list is called Paal1 but you’re currently trying to access a list with the name stored in a variable called Paal1. You simply want the list called Paal1.

Thanks for your reply “seconaryaccount”.

What you are suggesting is what I first tryed, but that does’t work. It seems not possible to address a listname directly via a join.

The goal is that you touch a pole (paal1, 2 or 3), which becomes the “PoleFrom” (PaalVan variable)
Next, you touch anoyher pole, which becomes the “PoleTo” (PaalNaar).
The top disc (schijf) now moves from PaalVan to PaalNaar.

The moving works fine, the problem is the logic with the poles.

This is the app where only the moving is done with 1 disc only (with debugging output).

I keep looking for solutions. If anyone can help, It would be great!

Thanks in advance!

Hi all,

The problem has been solved.
Here is how: Create a list of the sprites
Then, each sprite can be referenced as follows:
Thunkable uses the internal ID as a reference if you do it this way.

The only concern is that the sprites have to be in the right sequence in your design.

I hope this helps for anyone facing this ussue.

Happy Thunking!

1 Like