SHARE
TWEET

Untitled

a guest Apr 24th, 2019 60 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /**********************
  2.  * superDrEvalBros.js *
  3.  **********************
  4.  *
  5.  * You're still here?! Well, Dr. Eval, let's see
  6.  * how well you can operate with one less dimension.
  7.  *
  8.  * Give up now. Unless you have a magic mushroom
  9.  * up your sleeve, it's all over.
  10.  */
  11.  
  12. function startLevel(map) {
  13.     var fl = Math.floor;
  14.     var w = map.getWidth();
  15.     var h = map.getHeight();
  16.  
  17.     map.placePlayer(1, fl(h/2)-1);
  18.     var player = map.getPlayer();
  19.  
  20.     map.placeObject(w-1, fl(h/2)-1, 'exit');
  21.  
  22.     for (var x = 0; x < fl(w/2) - 5; x++) {
  23.         for (var y = fl(h/2); y < h; y++) {
  24.             map.placeObject(x, y, 'block');
  25.         }
  26.     }
  27.  
  28.     for (var x = fl(w/2) + 5; x <= w; x++) {
  29.         for (var y = fl(h/2); y < h; y++) {
  30.             map.placeObject(x, y, 'block');
  31.         }
  32.     }
  33.  
  34.     function gravity() {
  35.         var x = player.getX();
  36.         var y = player.getY() + 1;
  37.  
  38.         if (y === map.getHeight() - 2) {
  39.             player.killedBy("gravity");
  40.         }
  41.  
  42.         if (map.getObjectTypeAt(x,y) === "empty") {
  43.             player.move("down");
  44.         }
  45.  
  46.     }
  47.     map.startTimer(gravity, 45);
  48.  
  49.     function jump() {
  50.  
  51.  
  52. map.defineObject('bridge', {
  53.         'symbol': '░',
  54.         'color': '#44f',
  55.         'impassable': function (player) {
  56.             return true;
  57.         }
  58.     });
  59. map.placeObject(20,12,'bridge');
  60. map.placeObject(21,12,'bridge');
  61. map.placeObject(22,12,'bridge');
  62. map.placeObject(23,12,'bridge');
  63. map.placeObject(24,12,'bridge');
  64. map.placeObject(25,12,'bridge');
  65. map.placeObject(26,12,'bridge');
  66. map.placeObject(27,12,'bridge');
  67. map.placeObject(28,12,'bridge');
  68. map.placeObject(29,12,'bridge');
  69.  
  70.  
  71.     }
  72.  
  73.     player.setPhoneCallback(function () {
  74.         var x = player.getX();
  75.         var y = player.getY() + 1;
  76.  
  77.         if (map.getObjectTypeAt(x,y) !== "empty") {
  78.             jump();
  79.         }
  80.     });
  81. }
  82.  
  83. function validateLevel(map) {
  84.     map.validateExactlyXManyObjects(1, 'exit');
  85.     map.validateExactlyXManyObjects(520, 'block');
  86. }
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
 
Top