How do we programmatically set sprite size?

hi,
i am trying to show a progress bar in my app… i have sprites showing the various stages of the progress bar…but when i show the sprite in the stage/canvas, it appears as very small…
i used the SET sprite’s HEIGHT block and SET sprite’s WIDTH block, but still the size is not changing …please help

is it impossible to fill the entire canvas with the sprite?..when i try to set sprite’s height and width to the height and width of the canvas, its not even visible!..what should i do to fill the canvas with the sprite?

image
@tatiang @muneer

1 Like

Show your blocks.

image

@sumeshoouh the logic there looks ok - but when are you calling your FixCanvas function?

If it’s for a progress bar is there some event in your game that happens and updates the progress?

2 Likes

yes @domhnallohanlon , i am updating the progress bar with timer countdown…
but before that, i am first trying to show it in the canvas…The FixCanvas function is being called in Screen-Opens-event…the canvas is only in a small portion of the top part of the screen…canvas is not filling the entire screen as shown in available tutorials …but when i try to show a sprite its not visible…
the variables cxRegress, cyRegress are calculated by getting device-width and then calculating the percentage of width and height of the column, containing the canvas

1 Like

If this is the first attempt to use sprites, i advise to start with a canvas that is the size of the screen and provide x and y coordinates that you know are in the visible area of the screen to see your code in action.

Having done this successfully, start to implement your requires code step by step to know where it fails,

You are showing only a function which is part of your code and design which makes it difficult to suggest anything at the moment.

2 Likes

ok @muneer , i will create a project and will post its link

1 Like

@sumeshoouh not sure if you are required to use the canvas for this, but if not there’s a progress bar tutorial that might be useful:

2 Likes

this is a great idea…thanks @domhnallohanlon …but in my progress bar i have logo-picture as the moving tip of the progress bar…its like pointer in a slider…thats why i am left with only option to use canvas…i will create a project and post the link here…

1 Like

Two points on this;

  1. Is this a “nice to have” feature or a “have to have” feature?

  2. Are you using the latest DnD version of Thunkable?

1 Like

hi @domhnallohanlon,

  1. unfortunately, its a “have to have” feature…(out of my control…)
  2. no i am using the old version

Check this progress demo with an image and without canvas.
https://x.thunkable.com/projectPage/6116539221a7b8001144bf04

2 Likes

thanks @muneer .
thanks @domhnallohanlon
thanks @Dean_Artis

1 Like

@sumeshoouh did @muneer’s example solve this for you?

If so can you mark as “solved” please?

Thanks!

2 Likes

yes, sure…
thanks a lot

1 Like