View Single Post
  #1 (permalink)  
Old 09-17-2007, 01:08 AM
HelloWorld's Avatar
HelloWorld HelloWorld is offline
PT Admin
Awards Showcase
Quality Tutorial 
Total Awards: 1
Join Date: Jun 2007
Location: In front of computer...
Posts: 1,118
iTrader: (0)
HelloWorld is a jewel in the roughHelloWorld is a jewel in the roughHelloWorld is a jewel in the rough
Icon13 How do you Check Boundary Collision?

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.MaxX)
            {
                
shipPosition.MaxX;
            }
            else if (
shipPosition.MinX)
            {
                
shipPosition.MinX;
            }
            else if (
shipPosition.MaxY)
            {
                
shipPosition.MaxY;
            }
            else if (
shipPosition.MinY)
            {
                
shipPosition.MinY;
            }
        } 
I call this method in Update()

__________________
PHP Code:
System.out.println("Hello World!"); 

Digg this Post! Del.Icio.Us this Post! Technorati this Post! Furl this Post! Mister Wong this Post! Newsvine this Post! Spurl this Post! Reddit this Post! Netscape this Post!
Reply With Quote