I am trying to dynamically position a "Score" text element, on my hud (like "Score: 2300 pts"), at the horizontal center of the player's screen, under any resolution the game is played.
So I figured I'd set the Score.X to Screenwidth/2 at the beginning of the Layout.
I guess it is kind of working, but ScreenWidth is being reported wrong or something, because the Textbox (Score) is positioned not on the center of the game window but a bit to the left..
Also, on another case, I set the game character's Sprite to automatically bounce back whenever it hits the left or right borders of the game. But again, for this I am using Screenwidth (for the right border "X" position check). And again, the sprite goes past the right screen border for a bit (but ends up finally bouncing back).
So my guess is, ScreenWidth is reporting the wrong size.
Is this a known bug or something like that?
Or am I doing it wrong??
EDIT: It all works flawlessly when I go Fullscreen (F11) and reload the game (ScreenWidth is reported correctly). Is there a way to make it work in random-sized windowed mode?
:shock: :smile: : :?: :?:
So I figured I'd set the Score.X to Screenwidth/2 at the beginning of the Layout.
I guess it is kind of working, but ScreenWidth is being reported wrong or something, because the Textbox (Score) is positioned not on the center of the game window but a bit to the left..
Also, on another case, I set the game character's Sprite to automatically bounce back whenever it hits the left or right borders of the game. But again, for this I am using Screenwidth (for the right border "X" position check). And again, the sprite goes past the right screen border for a bit (but ends up finally bouncing back).
So my guess is, ScreenWidth is reporting the wrong size.
Is this a known bug or something like that?
Or am I doing it wrong??
EDIT: It all works flawlessly when I go Fullscreen (F11) and reload the game (ScreenWidth is reported correctly). Is there a way to make it work in random-sized windowed mode?
:shock: :smile: : :?: :?: