Why is the text sprite extention not working properly?

So, I’m using the text sprite extention by @darzu, and I can’t use sprite and text functions in the same time. When I try to retrieve the width and position the text sprite, it starts refusing to change the text on the sprite, returning the Property ‘setText’ does not exist on type ‘Sprite’ Please let me know if there is any way to avoid this. Thanks

1 Like

This is actually a bug that just got fixed on our side, so next to an update to arcade is released it will fix itself (here’s the fix for reference: https://github.com/microsoft/pxt/pull/8332).

A way to work around it for now / until that fix is released is to just put a an extra text sprite block as the first step in any event / function you use the textSprite – that is, if you have code like this and it is failing:

image

you can add a text sprite block first (max font height is probably easiest) to help the compiler fix itself:

image

again, this will be unnecessary after the next release – the issue is that it is trying to find the type for textSprite and it sees that it can be used as a sprite and doesn’t narrow it down any further (as text sprites are special kinds of sprites with their own properties).

2 Likes

Thanks! When will the next release come out?

1 Like