SHARE
TWEET

Untitled

a guest Dec 13th, 2018 46 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /********************
  2.  * theLongWayOut.js *
  3.  ********************
  4.  *
  5.  * Well, it looks like they're on to us. The path isn't as
  6.  * clear as I thought it'd be. But no matter - four clever
  7.  * characters should be enough to erase all their tricks.
  8.  */
  9.  
  10. function startLevel(map) {
  11.     map.placePlayer(7, 5);
  12.  
  13.     var maze = new ROT.Map.DividedMaze(map.getWidth(), map.getHeight());
  14. maze = {
  15.     create: function(){}
  16. };
  17.     maze.create( function (x, y, mapValue) {
  18.  
  19.         // don't write maze over player
  20.         if (map.getPlayer().atLocation(x,y)) {
  21.             return 0;
  22.         }
  23.  
  24.         else if (mapValue === 1) { //0 is empty space 1 is wall
  25.             map.placeObject(x,y, 'block');
  26.         }
  27.         else {
  28.             map.placeObject(x,y,'empty');
  29.         }
  30.     });
  31.  
  32.     map.placeObject(map.getWidth()-4, map.getHeight()-4, 'block');
  33.     map.placeObject(map.getWidth()-6, map.getHeight()-4, 'block');
  34.     map.placeObject(map.getWidth()-5, map.getHeight()-5, 'block');
  35.     map.placeObject(map.getWidth()-5, map.getHeight()-3, 'block');
  36. map.placeObject(map.getWidth()-1, map.getHeight()-1, 'exit');
  37.     map.placeObject(map.getWidth()-5, map.getHeight()-4, '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