// slides this background in, drawing the previous one behind it
 public void slideIn(KeysToInsanity.Boundary direction, ParallaxBackground previousBackground)
 {
     if (sliding == KeysToInsanity.Boundary.None)
     {
         previousBackgroundTexture = previousBackground.spriteTex;
         previousBackgroundTexture2 = previousBackground.background2Texture;
         previousRectangle = new Rectangle(0, 0, spriteSize.X, spriteSize.Y);
         previousRectangle2 = new Rectangle(0, 0, spriteSize.X + parallax, spriteSize.Y + parallax);
         sliding = direction;
         switch(sliding)
         {
             case KeysToInsanity.Boundary.Left:
                 spritePos = new Vector2(spritePos.X + spriteSize.X, spritePos.Y);
                 background2Rectangle = new Rectangle(previousRectangle2.X + previousRectangle2.Width, previousRectangle2.Y, spriteSize.X + parallax, spriteSize.Y + parallax);
                 break;
             case KeysToInsanity.Boundary.Right:
                 spritePos = new Vector2(spritePos.X - spriteSize.X, spritePos.Y);
                 background2Rectangle = new Rectangle(previousRectangle2.X - previousRectangle2.Width, previousRectangle2.Y, spriteSize.X + parallax, spriteSize.Y + parallax);
                 break;
             case KeysToInsanity.Boundary.Top:
                 spritePos = new Vector2(spritePos.X, spritePos.Y + spriteSize.Y);
                 background2Rectangle = new Rectangle(previousRectangle2.X, previousRectangle2.Y + previousRectangle2.Height, spriteSize.X + parallax, spriteSize.Y + parallax);
                 break;
             case KeysToInsanity.Boundary.Bottom:
                 spritePos = new Vector2(spritePos.X, spritePos.Y - spriteSize.Y);
                 background2Rectangle = new Rectangle(previousRectangle2.X, previousRectangle2.Y - previousRectangle2.Height, spriteSize.X + parallax, spriteSize.Y + parallax);
                 break;
             default:
                 break;
         }
         slide = true;
     }
 }
Example #2
0
 public void setStart(int x, int y, KeysToInsanity.Boundary b)
 {
     startX = x;
     startY = y;
     start = b;
 }
Example #3
0
 public void setEnd(int x, int y, KeysToInsanity.Boundary b)
 {
     endX = x;
     endY = y;
     end = b;
 }