Hi. Currently, I'm creating a game where a character needs to pass through the obstacles and earn scores before the timer ends. However, I'm facing an issue that I have no idea how to fix.
This is the interface that I want, where the timer, the score count, and the game interface are all there, but since the labels are above the canvas, the obstacles can't be spawned at the top of the screen, which I didn't want. I wanted an interface where all the things could be put together and the obstacles could be spawned at the exact top of the screen, but not the canvas. So, I tried another way,
and then realized that we can't put labels in a canvas, I know the 'drawText' thing exists, but as in the first screenshot I uploaded, I put the timer on the top right of the screen and the score on the top middle of the screen, which can't be done using 'drawText'. Does anyone know any method to solve this problem?
The X and Y options of the 'drawText' block are inaccurate in my opinion, there are many versions of Android. I want to put the text at the top right and the top middle no matter how big the Android user's screen is.
There are the blocks height and width of screens that give you the right value and then you have to calculate with density of pixels too.
Probably this is the problem of accuracy of you text position.
As @SteveJG has shown, it should simply be a matter of getting the canvas size (width) and work from that. If font size is an issue then again test the canvas width and set font size accordingly (a bit similar to using media queries in html)