public static void CollisionDectectExplorerMovingBlockDown(MovingBlock block)
 {
     if (explorer.CollisionRectangle.Intersects(block.Rectangle) &&
             explorer.State.ToString() == "PyramidPanic.Down" &&
                 explorer.CollisionRectangle.Bottom < block.Rectangle.Top + 4)          //+4 anders bij het teruglopen en weer omhoog gaan loopt de explorer door het steentje
     {
         level.Tiles[(int)block.CurrentIndex.X, (int)block.CurrentIndex.Y].TileCollision = TileCollision.Passable;
         block.State = new MovingBlockDown(block);
     }
 }
 public static bool CDMovingblockScorpion(MovingBlock block)
 {
     foreach (Scorpion scorpion in level.ScorpionList)
     {
         if (block.ColRectScorpion.Intersects(scorpion.ColRect))
         {
             return true;
         }
     }
     return false;
 }
        //§ nieuw explorer blokkeert het pad van de teruglopende steen omhoog en omlaag
        public static void CollisionDectectExplorerGoBackUp(MovingBlock block)
        {
            if (explorer.CollisionRectangle.Intersects(block.Rectangle))
            {
                if ( explorer.State.ToString() == "PyramidPanic.Idle"  ||
                     explorer.State.ToString() == "PyramidPanic.Left" ||
                     explorer.State.ToString() == "pp.ExplorerWalkRight")
                {
                    if (explorer.CollisionRectangle.Bottom - 2 < block.Rectangle.Top || //Steen blokkeren als steen naar boven gaat en explorer blokkeert pad
                        explorer.CollisionRectangle.Top + 2 > block.Rectangle.Bottom)   //Steen blokkeren als steen naar beneden gaat en explorer blokkeert pad
                    {
                        block.State = new MovingBlockIdleOffPlace(block);
                    }

                }
            }
        }
Exemplo n.º 4
0
 //Constructor
 public MovingBlockUp(MovingBlock block)
 {
     this.block = block;
 }
 //Constructor
 public MovingBlockGoBackDown(MovingBlock block)
 {
     this.block = block;
 }
 //Constructor
 public MovingBlockIdleOffPlace(MovingBlock block)
 {
     this.block = block;
 }
Exemplo n.º 7
0
 //Constructor
 public MovingBlockIdle(MovingBlock block)
 {
     this.block = block;
 }
 //§ 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.Tiles[(int)block.CurrentIndex.X, (int)block.CurrentIndex.Y].TileCollision = TileCollision.Notpassable;
         block.State = new MovingBlockIdle(block);
     }
 }
 //§ 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.Tiles[(int)block.CurrentIndex.X, (int)block.CurrentIndex.Y].TileCollision = TileCollision.Notpassable;
         block.State = new MovingBlockIdle(block);
     }
 }
Exemplo n.º 10
0
 //§ alles nieuw
 public static void DeCollisionDectectExplorerMovingBlockDown(MovingBlock block)
 {
     if ( !explorer.CollisionRectangle.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);  //§
         }
     }
 }
Exemplo n.º 11
0
 //§ nieuw blokkeert een movingblock als hij de muur raakt
 public static bool CollisionDectectionWalls(MovingBlock block)
 {
     if ( block.Location.Y > block.BorderBottom )
     {
         explorer.Position = new Vector2(block.CurrentIndex.X * 32, (block.CurrentIndex.Y - 1) * 32);
         block.Location = new Vector2(block.CurrentIndex.X * 32, (block.CurrentIndex.Y) * 32);
         explorer.State = new IdleMovingBlockIdle(explorer, "Down");
         return true;
     }
      if ( block.Location.Y < block.BorderTop )
     {
         explorer.Position = 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.State = new IdleMovingBlockIdle(explorer, "Up");
         return true;
     }
     return false;
 }