Good night guys, I’m creating a game with a character that and a swimmer wanted to know how to make the cylinder decrease.
The way I’d do it is to make the bar out of a sprite, with the x origin on the left edge. Then, decrease the scale of this sprite (from 1 down to 0). Once the scale reaches 0, the oxygen tank is empty. It’s a very simple solution, and you don’t need to store the oxygen levels in a variable.
An alternative is draw the bar using a shape painter object. But that requires keeping track of the percentage tank that’s filled with oxygen, and calculating the line positions.
nice, but not sprite, and variable.
It’d be quite easy to change your object to a sprite and scale it on the x-axis (with or without a variable). Otherwise, can you explain what you have at present.
But personally, I’d change it to a sprite. It’s simple, and there’s less chance of things going wrong.
clarified what gets scaled