SHARE
TWEET

Untitled

a guest Jul 23rd, 2019 69 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /************************
  2.  * validationEngaged.js *
  3.  ************************
  4.  *
  5.  * They're really on to us now! The validateLevel function
  6.  * has been activated to enforce constraints on what you can
  7.  * do. In this case, you're not allowed to remove any blocks.
  8.  *
  9.  * They're doing all they can to keep you here. But you
  10.  * can still outsmart them.
  11.  */
  12.  
  13. function startLevel(map) {
  14.     map.placePlayer(map.getWidth()-7, map.getHeight()-5);
  15.  
  16.  
  17.     for (y = 10; y <= map.getHeight() - 3; y++) {
  18.         map.placeObject(25, y, 'block');
  19.         map.placeObject(map.getWidth() - 5, y, 'block');
  20.     }
  21.  
  22.     for (x = 5; x <= map.getWidth() - 5; x++) {
  23.         map.placeObject(x, 0, 'block');
  24.         map.placeObject(x, map.getHeight() - 3, 'block');
  25.     }
  26.    
  27.    
  28.    
  29.  
  30.     map.placeObject(7, 5, 'exit');
  31. }
  32.  
  33. function validateLevel(map) {
  34.     numBlocks = 2 * (map.getHeight()-13) + 2 * (map.getWidth()-10);
  35.  
  36.     map.validateAtLeastXObjects(numBlocks, 'block');
  37.     map.validateExactlyXManyObjects(1, 'exit');
  38. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top