Sprites on Canvas show on Live Test but not on Android Mobile

I have designed a simple game of Hangman. I have used Canvas and few Sprites.
In the beginning, the Sprites do not show up but as the user tries to guess alphabets, different Sprites show up.

This works perfectly in Live Test - please refer “Hangman Screenshot 1” file. However, when I see the same game on Thunkable App on my Android phone, the Canvas is not visible at all. I waited for few minutes (just in case images take time to load), it still doesn’t show. – please refer “Hangman Screenshot 2” file.

The same issue comes when I download and install Android APK.

I searched documentation and found that there may be issue with PNG images. So I chanegd to JPG, no success. I tried GIF also, but no success.

Can you please guide me?

Check the use of the when loads Canvas block

Dear @actech, Thanks for your quick reply.

In the “when Canvas loads” block, I have moved my Sprites out of Canvas. When the user presses an alphabet (which are displayed on screen), these Sprites start showing up on Canvas. I move them back to Canvas if the guessed alphabet is wrong.

As I have mentioned earlier, this functionality works perfect on Live Test. But not on android mobile.

If you give me a link to your project, I can determine the reason.

Here is the link of my project:
https://x.thunkable.com/copy/23174adc0c96e00887dcc704931fff34

My God! How many duplicate blocks! You probably did this app for at least one month!

But I see a problem with the canvas.

This is based on my understanding of how to use Thunkable… :smiley:

Please help me fix the Canvas issue.
Also, if you could help with how to optimize it - that will be cherry on the cake.

I added a blank canvas and it works. So there’s a problem with the main canvas.

When you created sprites, you tested the app on your device and it worked. When did you notice that the canvas stopped working on your device?

I deleted all the blocks, but the canvas doesn’t work either.

I think there is a problem with overloading the canvas with sprites. When I deleted a few sprites, the canvas started working on Android.

When I completed the program to my satisfaction, I downloaded it for Android and installed on my phone. There I noticed that Sprites are not loading (after initial screen). Later I checked Live Companion app of Thunkable and faced the same issue.

Since I have to show alphabets, I need 26 Sprites. Plus 5 spaces (= 5 more Sprites) and 4 Sprites for Hangman. Is there any better way to achieve / optimize this?

I created 200 sprites programmatically and don’t see a problem with that number. Also uploaded a large image - also no problem. Apparently, the problem is that sprites are added on the panel, or there is a bad sprite that causes a crash. I can’t understand it yet.

Oh okay!!

I am also trying to recreate the Sprites and will experiment. Appreciate if you could help resolve it.

I started deleting sprites from the top and after deleting Type_Sprite 8 the canvas started working.

I’m afraid re-creating it won’t solve the problem

Thanks for your assistance. I am wondering why that Sprite and the Canvas is not functioning correctly… :frowning_face:

I checked your project again and see that the problem is not with sprite. This time I started deleting all the sprites from the beginning and the canvas only started working when I got to the letter sprites. After that, I added 5-6 sprites and the canvas still worked.

Unfortunately, I can’t answer your question. There is a workaround, but it is only available to programmers who know how to work with HTML canvas and JavaScript

About optimization.

  1. I recommend that you study all the blocks for working with the list and use the block for creating a list from a line of text with separators to get the list.

  2. also look at any blocks - this will allow you to reduce the processing blocks for clicking on buttons

  3. you have a very long condition. See how it can be shortened. To do this, study the concept of functions

Thanks @actech for spending time to help me. I will build this app once again by keeping in mind your suggestions.

Thanks.

Hi have you find a solution for this issue, because I found the problem like you as well
No matter I rebuild and keep changing sprite, it still be the same doesn’t work