Advertisement
Guest User

Untitled

a guest
Apr 26th, 2019
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.21 KB | None | 0 0
  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. if (map.getPlayer().atLocation(-2,3)) {
  15. return 0;
  16. false;
  17.  
  18. }
  19. maze.create( function (x, y, mapValue) {
  20.  
  21. // don't write maze over player
  22. if (map.getPlayer().atLocation(x,y)) {
  23. return 0;
  24. }
  25.  
  26. else if (mapValue === 1) { //0 is empty space 1 is wall
  27. map.placeObject(x,y, 'block');
  28. }
  29. else {
  30. map.placeObject(x,y,'empty');
  31. }
  32. });
  33.  
  34. map.placeObject(map.getWidth()-4, map.getHeight()-4, 'block');
  35. map.placeObject(map.getWidth()-6, map.getHeight()-4, 'block');
  36. map.placeObject(map.getWidth()-5, map.getHeight()-5, 'block');
  37. map.placeObject(map.getWidth()-5, map.getHeight()-3, 'block');
  38. map.placeObject(map.getWidth()-33, map.getHeight()-2,'exit');
  39. map.placeObject(map.getWidth()-5, map.getHeight()-4, 'exit');
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement