Position sprite at center of screen
Posted
by
Wellie
on Game Development
See other posts from Game Development
or by Wellie
Published on 2012-05-31T00:36:48Z
Indexed on
2012/05/31
4:50 UTC
Read the original article
Hit count: 191
XNA
|windows-phone-7
I am trying to get a sprite to position itself at the center of the screen but nothing seems to be working for me. I'm trying
Viewport viewport = graphics.GraphicsDevice.Viewport;
logoPosition = new Vector2((viewport.Width - towerImage.Width) / 2,
(viewport.Height - towerImage.Height) / 2);
and
spriteBatch.Draw(towerImage, centre, null, Color.White, 0, baseOrigin, 1.0f, SpriteEffects.None, 0);
This is my first time using XNA and I don't really have a clue what I'm doing.
© Game Development or respective owner