コード例 #1
0
 //§
 //Omhoog duwen van blokje
 public static void CollisionDectectExplorerMovingBlockUp(MovingBlock block)
 {
     if (explorer.CollisionRect.Intersects(block.Rectangle) &&
                 explorer.IState.ToString() == "pp.ExplorerWalkUp" &&
                     explorer.CollisionRect.Top > block.Rectangle.Bottom - 4)        //-4 anders bij het teruglopen en weer omhoog gaan loopt de explorer door het steentje
     {
         level.Blocks[(int)block.CurrentIndex.X, (int)block.CurrentIndex.Y].BlockCollision = BlockCollision.Passable;
         block.State = new MovingBlockUp(block);
     }
 }
コード例 #2
0
 //§ nieuw explorer blokkeert het pad van de teruglopende steen omhoog en omlaag
 public static void CollisionDectectExplorerGoBackUp(MovingBlock block)
 {
     if (explorer.CollisionRect.Intersects(block.Rectangle))
     {
         if ( explorer.IState.ToString() == "pp.Idle"  ||
              explorer.IState.ToString() == "pp.ExplorerWalkLeft" ||
              explorer.IState.ToString() == "pp.ExplorerWalkRight")
         {
             if (explorer.CollisionRect.Bottom - 2 < block.Rectangle.Top || //Steen blokkeren als steen naar boven gaat en explorer blokkeert pad
                 explorer.CollisionRect.Top + 2 > block.Rectangle.Bottom)   //Steen blokkeren als steen naar beneden gaat en explorer blokkeert pad
             {
                 block.State = new MovingBlockIdleOffPlace(block);
             }
             //if (explorer.CollisionRect.Top > block.Rectangle.Top)     heeft geen functie meer
             //{
             //    explorer.Speed = 2000.0f;
             //}
         }
     }
 }
コード例 #3
0
 //Constructor
 public MovingBlockGoBackRight(MovingBlock block)
 {
     this.block = block;
 }
コード例 #4
0
 //Constructor
 public MovingBlockLeft(MovingBlock block)
 {
     this.block = block;
 }
コード例 #5
0
        //§ nieuw blokkeert een movingblock als hij de muur raakt
        public static bool CollisionDectectionWalls(MovingBlock block)
        {
            if ( block.Location.Y > block.BorderBottom )
            {
                explorer.Location = new Vector2(block.CurrentIndex.X * 32, (block.CurrentIndex.Y - 1) * 32);
                block.Location = new Vector2(block.CurrentIndex.X * 32, (block.CurrentIndex.Y) * 32);
                explorer.IState = new IdleExplorerMovingBlockStandStill(explorer, "Down");
                return true;
            }

            if ( block.Location.Y < block.BorderTop )
            {
                explorer.Location = new Vector2(block.CurrentIndex.X * 32, (block.CurrentIndex.Y + 2) * 32);
                block.Location = new Vector2(block.CurrentIndex.X * 32, (block.CurrentIndex.Y + 1) * 32);
                explorer.IState = new IdleExplorerMovingBlockStandStill(explorer, "Up");
                return true;
            }
            return false;
        }
コード例 #6
0
 //§ nieuw zorgt ervoor dat een omlaaggaande steen weer op de startpositie terecht komt
 public static void SetBackOnPlaceGoingDown(MovingBlock block)
 {
     if (block.Location.Y > block.StartLocation.Y)
     {
         block.Location = block.StartLocation;
         level.Blocks[(int)block.CurrentIndex.X, (int)block.CurrentIndex.Y].BlockCollision = BlockCollision.NotPassable;
         block.State = new MovingBlockIdle(block);
     }
 }
コード例 #7
0
 //§ zorgt ervoor dat een omhooggaande steen weer op de startpositie terecht komt
 public static void SetBackOnPlaceGoingUp(MovingBlock block)
 {
     if (block.Location.Y < block.StartLocation.Y)               //Zou 1 methode kunnen worden met de onderstaande SetBackOnPlaceGoingDown(MovingBlock block)
     {
         block.Location = block.StartLocation;
         level.Blocks[(int)block.CurrentIndex.X, (int)block.CurrentIndex.Y].BlockCollision = BlockCollision.NotPassable;
         block.State = new MovingBlockIdle(block);
     }
 }
コード例 #8
0
 //§ alles nieuw
 public static void DeCollisionDectectExplorerMovingBlockDown(MovingBlock block)
 {
     if ( !explorer.CollisionRect.Intersects(block.Rectangle))
     {
         if (block.Location.Y > block.StartLocation.Y)
         {
             block.State = new MovingBlockGoBackUp(block);
         }
         else if (block.Location.Y < block.StartLocation.Y)
         {
             block.State = new MovingBlockGoBackDown(block);  //§
         }
     }
 }
コード例 #9
0
 //Constructor
 public MovingBlockGoBackDown(MovingBlock block)
 {
     this.block = block;
 }
コード例 #10
0
 //constructor
 public MovingBlockUp(MovingBlock block)
 {
     this.block = block;
 }
コード例 #11
0
 //Constructor
 public MovingBlockIdle(MovingBlock block)
 {
     this.block = block;
 }
コード例 #12
0
 //Constructor
 public MovingBlockIdleOffPlace(MovingBlock block)
 {
     this.block = block;
 }