Need a unique gift idea?
A Pastebin account makes a great Christmas gift
SHARE
TWEET

Untitled

a guest Dec 6th, 2018 54 Never
Upgrade to PRO!
ENDING IN00days00hours00mins00secs
 
  1. /**********************
  2.  * fordingTheRiver.js *
  3.  **********************
  4.  *
  5.  * And there's the river. Fortunately, I was prepared for this.
  6.  * See the raft on the other side?
  7.  *
  8.  * Everything is going according to plan.
  9.  */
  10.  
  11. function startLevel(map) {
  12.     var raftDirection = 'down';
  13.  
  14.     map.placePlayer(map.getWidth()-1, map.getHeight()-1);
  15.     var player = map.getPlayer();
  16.  
  17.     map.defineObject('raft', {
  18.         'type': 'dynamic',
  19.         'symbol': '▓',
  20.         'color': '#420',
  21.         'transport': true, // (prevents player from drowning in water)
  22.         'behavior': function (me) {
  23.             me.move(raftDirection);
  24.         }
  25.     });
  26.  
  27.     map.defineObject('water', {
  28.         'symbol': '░',
  29.         'color': '#44f',
  30.         'onCollision': function (player) {
  31.             player.killedBy('drowning in deep dark water');
  32.         }
  33.     });
  34.  
  35.     for (var x = 0; x < map.getWidth(); x++) {
  36.         for (var y = 5; y < 15; y++) {
  37.             map.placeObject(x, y, 'water');
  38.         }
  39.     }
  40.  
  41.     map.placeObject(20, 5, 'raft');
  42.     map.placeObject(0, 2, 'exit');
  43.     map.placeObject(0, 1, 'block');
  44.     map.placeObject(1, 1, 'block');
  45.     map.placeObject(0, 3, 'block');
  46.     map.placeObject(1, 3, 'block');
  47.  
  48.  
  49.     map.defineObject('raft2', {
  50.         'type': 'dynamic',
  51.         'symbol': '▓',
  52.         'color': '#420',
  53.         'transport': true, // (prevents player from drowning in water)
  54.         'behavior': function (me) {
  55.             me.move(raftDirection);
  56.         }
  57.     });
  58.  
  59.     for(var i = 0; i < 20; i++)
  60.         map.placeObject(21, i, 'raft2');
  61.  
  62. }
  63.  
  64. function validateLevel(map) {
  65.     map.validateExactlyXManyObjects(1, 'exit');
  66.     map.validateExactlyXManyObjects(1, 'raft');
  67. }
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