简体   繁体   中英

How can i get a fixed position in a window with XNA?

I have to show my score in my game but I use 2D camera and when I move the writing "score" remains behind my player. I tried this but it doesn't function ofcr:

spriteBatch.DrawString(font, "Score: "+ score, /*param of the position */, Color.Gold);

From what I can tell, if you pass it a fixed Vector2 position, it should work. If not, it is not a problem related to that drawing line, but elsewhere in the code.

Perhaps an incorrect configuration of the viewport, or maybe you are 'spriteBatch.Begin'ing it incorrectly (weird transforming or the like?)

Regardless, we'll need to see some more code before we can correctly determine the problem.

我无法正确理解您的问题,但是:使用SpriteSortMode.BackToFront并将文本呈现为最后一项。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM