I am trying to do some basic collision with some sprites. Left side of the screen is fine and dandy you can just use 0. The right side of the screen has proven to be a bit more difficult. With a set resolution I could just hard code the resolution but that won’t be useful for everyone. I have tried to get the screen width using the GraphicsDevice.Viewport.Width; property. However, the property returns to me null ;
- Inside LoadContent() , I initialise an object of Game1 to access GraphicsDevice and set a member variable to Graphics.Device.Viewport.Width. The member variable is = 0 or null.