PHP Code:
int MaxX = ScreenManager.GraphicsDevice.Viewport.Width - 50;
int MinX = 0;
int MaxY = ScreenManager.GraphicsDevice.Viewport.Height - 50;
int MinY = 0;
For some reason, the Max, and Min Y doesn't work... But Max X, and Min X works fine, though I need to adjust the value... Please help me on this, I'm trying to detect boundary collision in the full screen game... thanx in advance
Here's the full method:
PHP Code:
public void CheckBoundaryCollision()
{
int MaxX = ScreenManager.GraphicsDevice.Viewport.Width - 50;
int MinX = 0;
int MaxY = ScreenManager.GraphicsDevice.Viewport.Height - 50;
int MinY = 0;
if (shipPosition.X > MaxX)
{
shipPosition.X = MaxX;
}
else if (shipPosition.X < MinX)
{
shipPosition.X = MinX;
}
else if (shipPosition.Y > MaxY)
{
shipPosition.Y = MaxY;
}
else if (shipPosition.Y < MinY)
{
shipPosition.Y = MinY;
}
}
I call this method in Update()