# Problem with using text/variables on Canvas blocks

**URL:** <https://community.thunkable.com/t/problem-with-using-text-variables-on-canvas-blocks/3783834>\
**Category:** Questions about Thunkable X\
**Tags:** canvas, help\
**Created:** [April 29, 2025, 2:08pm UTC](https://community.thunkable.com/t/problem-with-using-text-variables-on-canvas-blocks/3783834 "2025-04-29T14:08:21Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![grant.mccallum](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/grant.mccallum/32/210541_2.png) [@grant.mccallum](https://community.thunkable.com/u/grant.mccallum)\
**Post date:** [April 29, 2025, 2:08pm UTC](https://community.thunkable.com/t/problem-with-using-text-variables-on-canvas-blocks/3783834/1 "2025-04-29T14:08:21Z")

</div>

Why does this work?

 ![Works](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/f/1/f16b393a63369ac831e60bdfbc9006255c848891.png)  
Output - beaver sprite rotates to face wherever you touch on the screen/

But this doesn’t work:

 ![Doesn't Work](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/6/b/6ba516dd0f6bc45a6ef77acec8458891ecdb7a9a.png)

Output - beaver sprite ignores touches on screen.

---

<div class="post-metadata">

**Author:** ![grant.mccallum](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/grant.mccallum/32/210541_2.png) [@grant.mccallum](https://community.thunkable.com/u/grant.mccallum)\
**Post date:** [April 29, 2025, 6:47pm UTC](https://community.thunkable.com/t/problem-with-using-text-variables-on-canvas-blocks/3783834/2 "2025-04-29T18:47:56Z")

</div>

Bumping this one to the top

---

<div class="post-metadata">

**Author:** ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)\
**Post date:** [April 30, 2025, 4:38am UTC](https://community.thunkable.com/t/problem-with-using-text-variables-on-canvas-blocks/3783834/3 "2025-04-30T04:38:49Z")

</div>

The top blocks use a sprite object but the bottom blocks use the word “sprite” which doesn’t relate to an actual sprite in Thunkable.

---

<div class="post-metadata">

**Author:** ![grant.mccallum](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/grant.mccallum/32/210541_2.png) [@grant.mccallum](https://community.thunkable.com/u/grant.mccallum)\
**Post date:** [April 30, 2025, 11:02am UTC](https://community.thunkable.com/t/problem-with-using-text-variables-on-canvas-blocks/3783834/4 "2025-04-30T11:02:53Z")

</div>

Hi Tatiang, I’m trying to create a setup where the behaviour of the sprites on my canvas is governed by text variables - is there no way to do this in thunkable?

I suppose what I’m asking is, how can I create a variable which Thunkable will recognise as a sprite object?

Without that functionality, it would take a hell of a lot of repeated blocks to generate any meaningful animations.

---

<div class="post-metadata">

**Author:** ![grant.mccallum](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/grant.mccallum/32/210541_2.png) [@grant.mccallum](https://community.thunkable.com/u/grant.mccallum)\
**Post date:** [May 21, 2025, 10:55pm UTC](https://community.thunkable.com/t/problem-with-using-text-variables-on-canvas-blocks/3783834/5 "2025-05-21T22:55:29Z")

</div>

Bumping this one back to the top in hopes of getting answer, is it possible?

---

<div class="post-metadata">

**Author:** ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)\
**Post date:** [May 22, 2025, 2:21am UTC](https://community.thunkable.com/t/problem-with-using-text-variables-on-canvas-blocks/3783834/6 "2025-05-22T02:21:36Z")

</div>

> [@grant.mccallum](#):
>
> how can I create a variable which Thunkable will recognise as a sprite object?

Can you give an example of this that wouldn’t work with standard app variables? I assume you’re wanting to do something like sprite1.tag, sprite2.tag, etc. where _tag_ is a unique value…?

---

<div class="post-metadata">

**Author:** ![grant.mccallum](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/grant.mccallum/32/210541_2.png) [@grant.mccallum](https://community.thunkable.com/u/grant.mccallum)\
**Post date:** [May 24, 2025, 10:00am UTC](https://community.thunkable.com/t/problem-with-using-text-variables-on-canvas-blocks/3783834/7 "2025-05-24T10:00:12Z")

</div>

Hi Tatiang,

I think it would be easiest for me to set a simple challenge down here.

You have two sprites on the canvas - sprite1 and sprite 2.

 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/2/8/285783113dc37a94ca7bcef33ca28f27af156bc1.png)

The behaviour we are targeting is when the user presses on the screen, sprite 1 will move towards the active pointer and sprite 2 will rotate to face sprite 1 in its new position. We can create this effect with this block:

 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/a/5/a5834703f7b97e1bca994b9598825744fa450a50.png)

Your challenge is to initiate these two variables to a value which will enable this block to show the same behaviour:

 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/e/b/eb466378306b15d1b3874c714a0d375a98155f9f.png)

The reason that this is the challenge is that in order to build anything substantial using the canvas functionality, I will need a way of linking variables to sprites. if I I can do that then I can build something with 100’s of blocks rather than 1000’s.

Project: [Thunkable](https://x.thunkable.com/projects/683090071876d86c2a6354a2/7573c6de-8d6c-4ee1-886d-8c6197c1e69c/blocks)

---

<div class="post-metadata">

**Author:** ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)\
**Post date:** [May 24, 2025, 4:06pm UTC](https://community.thunkable.com/t/problem-with-using-text-variables-on-canvas-blocks/3783834/8 "2025-05-24T16:06:30Z")

</div>

You can do this with Any Component blocks. Use variables to represent the sprite component indexes (1 for the first sprite, 2 for the second sprite, etc.).

Project link: [Thunkable](https://x.thunkable.com/copy/b11f4bad5b9a81dae0e44a19a268e584)

 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/9/0/90bdbfa0dc3a9e37633b63b53421251612fc58b6.png)

---

<div class="post-metadata">

**Author:** ![grant.mccallum](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/grant.mccallum/32/210541_2.png) [@grant.mccallum](https://community.thunkable.com/u/grant.mccallum)\
**Post date:** [May 24, 2025, 4:51pm UTC](https://community.thunkable.com/t/problem-with-using-text-variables-on-canvas-blocks/3783834/9 "2025-05-24T16:51:13Z")

</div>

Thanks Tatiang, what governs the index number of the sprites? Is it the order they appear in your component tree? (1 for the first, 2 for the 2nd etc.)

---

<div class="post-metadata">

**Author:** ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)\
**Post date:** [May 24, 2025, 9:04pm UTC](https://community.thunkable.com/t/problem-with-using-text-variables-on-canvas-blocks/3783834/10 "2025-05-24T21:04:24Z")

</div>

Yes, the order in the component tree. If you are placing them manually or spawning them then you will know the order. It’s tougher to figure out which sprite is which based on a condition. But you still can… you have to find out where in the list of all Sprites the component ID of that sprite is listed and then use that as the value of `app variable Sprite`.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/0/f/0f59f292712368bce16ff80133ae10de8a6f27e8.png) [@system](https://community.thunkable.com/u/system)\
**Post date:** [August 22, 2025, 9:05pm UTC](https://community.thunkable.com/t/problem-with-using-text-variables-on-canvas-blocks/3783834/11 "2025-08-22T21:05:23Z")

</div>

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.
